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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1c1c0fdf606dec750b89a31956d98ee6abf5ea72 | 838 | py | Python | examples/event_trigger_demo.py | vishalbala-nps/dialogflow_py | 778326d93bd0d6ba4839e3de09ada8a901643e11 | [
"MIT"
] | 3 | 2020-04-28T14:31:09.000Z | 2020-09-04T17:08:57.000Z | examples/event_trigger_demo.py | vishalbala-nps/dialogflow_py | 778326d93bd0d6ba4839e3de09ada8a901643e11 | [
"MIT"
] | null | null | null | examples/event_trigger_demo.py | vishalbala-nps/dialogflow_py | 778326d93bd0d6ba4839e3de09ada8a901643e11 | [
"MIT"
] | null | null | null | """
This is a Simple Demo to demonstrate triggering intents by event name instead of using Utterances.
Here, trigintent is triggered by an event (called intent_trigger) from intent2
"""
from flask import *
import dialogflowpy_webhook
app = Flask(__name__)
app.route("/")
def main():
intent_handler = dialogflowpy_we... | 39.904762 | 98 | 0.756563 | from flask import *
import dialogflowpy_webhook
app = Flask(__name__)
app.route("/")
def main():
intent_handler = dialogflowpy_webhook.request_handler(request.get_json())
response_handler = dialogflowpy_webhook.response_handler()
intent = intent_handler.get_intent_displayName()
if intent == "intent1":... | true | true |
1c1c103fc8ffd4f45a6216e7224b913037e329d1 | 2,871 | py | Python | gpx_correct.py | michlkallen/gpx_mapping | 8272b8a1d99d9d4c80933163eddf32a6d66583e6 | [
"MIT"
] | null | null | null | gpx_correct.py | michlkallen/gpx_mapping | 8272b8a1d99d9d4c80933163eddf32a6d66583e6 | [
"MIT"
] | null | null | null | gpx_correct.py | michlkallen/gpx_mapping | 8272b8a1d99d9d4c80933163eddf32a6d66583e6 | [
"MIT"
] | null | null | null | """
Script to correct timestamps on GPX files.
Use if creating a GPX file manually through www.gpxgenerator.com
and the speed used is incorrect. (Or if you want to modify an existing route.)
To use:
-------
1. Edit the `file_in` name and the `file_out` name if desired.
2. Edit the average speed (and variability) if d... | 29.295918 | 87 | 0.666667 | import xml.etree.ElementTree as ET
import numpy as np
import pandas as pd
import haversine
file_in = "0331.gpx"
file_out = file_in[:-4] + "-analog.gpx"
avg_rate = 265
var = 10
ns = {"gpx": "http://www.topografix.com/GPX/1/1"}
elev_gain = [0]
distance = [0]
elev = [0]
tree = ET.parse(file_in)
latitude = [
... | true | true |
1c1c10a4c488ba320287c333c721fb21cd38bba5 | 2,970 | py | Python | spear/utils/utils_jl.py | decile-team/spear | 8f8641927325090f85af7a86bc8a5795ea4c3da9 | [
"MIT"
] | 89 | 2021-06-14T17:38:30.000Z | 2022-03-31T05:16:26.000Z | spear/utils/utils_jl.py | harshading/spear | 7629cc46ce738a4a67e5b4a6ba7d1935c4833421 | [
"MIT"
] | null | null | null | spear/utils/utils_jl.py | harshading/spear | 7629cc46ce738a4a67e5b4a6ba7d1935c4833421 | [
"MIT"
] | 7 | 2021-06-14T17:38:32.000Z | 2021-12-25T22:44:45.000Z | import torch.nn as nn
from torch import log
import numpy as np
from .utils_cage import probability
def log_likelihood_loss_supervised(theta, pi, y, m, s, k, n_classes, continuous_mask, qc, device):
'''
Joint Learning utils: Negative log likelihood loss, used in loss 4 in :cite:p:`DBLP:journals/corr/abs-2008-09887... | 31.935484 | 121 | 0.714815 | import torch.nn as nn
from torch import log
import numpy as np
from .utils_cage import probability
def log_likelihood_loss_supervised(theta, pi, y, m, s, k, n_classes, continuous_mask, qc, device):
prob = probability(theta, pi, m, s, k, n_classes, continuous_mask, qc, device)
prob = (prob.t() / prob.sum(1)).t()
r... | true | true |
1c1c113b3adb0887da527de7ac5304623eb4ea2a | 3,117 | py | Python | traffic_intersection/contracts/testcases.py | tungminhphan/street_intersection | 8c10548ce9c1939f5ca01efddf207f0bda77773a | [
"BSD-3-Clause"
] | 11 | 2018-07-13T05:02:04.000Z | 2021-06-11T14:13:50.000Z | traffic_intersection/contracts/testcases.py | tungminhphan/street_intersection | 8c10548ce9c1939f5ca01efddf207f0bda77773a | [
"BSD-3-Clause"
] | 4 | 2021-03-19T16:07:22.000Z | 2022-03-12T00:54:32.000Z | traffic_intersection/contracts/testcases.py | tungminhphan/street_intersection | 8c10548ce9c1939f5ca01efddf207f0bda77773a | [
"BSD-3-Clause"
] | 7 | 2018-07-29T21:54:00.000Z | 2021-01-04T22:23:07.000Z | import automaton as a
import numpy as np
h_traffic = ['red_h', 'green_h', 'yellow_h']
h_trans = {}
h_trans[('red_h', 'green_h')] = ('h_timer == 45', set(), {'green_h'}, set())
h_trans[('green_h', 'yellow_h')] = ('h_timer == 40', set(), set(), set())
h_trans[('yellow_h', 'red_h')] = ('h_timer == 5', set(), {'red_h'}, s... | 51.95 | 126 | 0.627526 | import automaton as a
import numpy as np
h_traffic = ['red_h', 'green_h', 'yellow_h']
h_trans = {}
h_trans[('red_h', 'green_h')] = ('h_timer == 45', set(), {'green_h'}, set())
h_trans[('green_h', 'yellow_h')] = ('h_timer == 40', set(), set(), set())
h_trans[('yellow_h', 'red_h')] = ('h_timer == 5', set(), {'red_h'}, s... | true | true |
1c1c11e26bcfaf8b71f2349939b185e6670d02b2 | 996 | py | Python | xsdata/codegen/handlers/attribute_name_conflict.py | akretion/xsdata | 3bedb4ac3e0e6eb6a1cdbad54a3356f46e3ab90e | [
"MIT"
] | null | null | null | xsdata/codegen/handlers/attribute_name_conflict.py | akretion/xsdata | 3bedb4ac3e0e6eb6a1cdbad54a3356f46e3ab90e | [
"MIT"
] | null | null | null | xsdata/codegen/handlers/attribute_name_conflict.py | akretion/xsdata | 3bedb4ac3e0e6eb6a1cdbad54a3356f46e3ab90e | [
"MIT"
] | null | null | null | from xsdata.codegen.mixins import HandlerInterface
from xsdata.codegen.models import Attr
from xsdata.codegen.models import Class
from xsdata.codegen.utils import ClassUtils
from xsdata.utils.collections import group_by
from xsdata.utils.constants import DEFAULT_ATTR_NAME
def attr_group_name(x: Attr) -> str:
retu... | 35.571429 | 74 | 0.716867 | from xsdata.codegen.mixins import HandlerInterface
from xsdata.codegen.models import Attr
from xsdata.codegen.models import Class
from xsdata.codegen.utils import ClassUtils
from xsdata.utils.collections import group_by
from xsdata.utils.constants import DEFAULT_ATTR_NAME
def attr_group_name(x: Attr) -> str:
retu... | true | true |
1c1c11eb3cb8f69cce76897dcdcebc179b9e064f | 8,880 | py | Python | tools/pip/setup.py | pioy/incubator-mxnet | 9d432079f489327ec6daab61326a3e4f3c7cb8b3 | [
"Apache-2.0"
] | 1 | 2020-09-02T09:17:51.000Z | 2020-09-02T09:17:51.000Z | tools/pip/setup.py | pioy/incubator-mxnet | 9d432079f489327ec6daab61326a3e4f3c7cb8b3 | [
"Apache-2.0"
] | null | null | null | tools/pip/setup.py | pioy/incubator-mxnet | 9d432079f489327ec6daab61326a3e4f3c7cb8b3 | [
"Apache-2.0"
] | 1 | 2020-09-02T09:17:54.000Z | 2020-09-02T09:17:54.000Z | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 43.529412 | 125 | 0.705856 |
from __future__ import absolute_import
from datetime import datetime
import os
import sys
import shutil
import platform
if platform.system() == 'Linux':
sys.argv.append('--universal')
sys.argv.append('--plat-name=manylinux2014_x86_64')
from setuptools import setup, find_packages
from setupt... | true | true |
1c1c122ade0d1d68f5d3b2ef377e7c126f11a1eb | 6,842 | py | Python | modules/sql/rankingsdb.py | kammerjager/Yume-Bot | c3099b929e30602deec23967c7a49f389b5a6d2c | [
"MIT"
] | null | null | null | modules/sql/rankingsdb.py | kammerjager/Yume-Bot | c3099b929e30602deec23967c7a49f389b5a6d2c | [
"MIT"
] | null | null | null | modules/sql/rankingsdb.py | kammerjager/Yume-Bot | c3099b929e30602deec23967c7a49f389b5a6d2c | [
"MIT"
] | null | null | null | # Copyright (c) 2020.
# MIT License
#
# Copyright (c) 2019 YumeNetwork
#
# 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
# ... | 34.38191 | 134 | 0.563724 |
import numpy as np
import pandas
import psycopg2
from psycopg2 import extras
from modules.sql.guild import Guild
from modules.sql.user import User
try:
con = psycopg2.connect("host=postgre dbname=yumebot port=5432 user=postgres password=yumebot")
cur = con.cursor(cursor_factory=psycopg2... | true | true |
1c1c126b97ef252a4997c60fe488209c90bcaf5f | 2,901 | py | Python | tweeter/cli.py | mmerickel/twitter-listener | 8909f53deaf19e835917703e5a63233516bc5440 | [
"MIT"
] | 1 | 2019-09-16T15:46:10.000Z | 2019-09-16T15:46:10.000Z | tweeter/cli.py | mmerickel/twitter-listener | 8909f53deaf19e835917703e5a63233516bc5440 | [
"MIT"
] | 3 | 2021-11-13T18:55:16.000Z | 2021-11-13T18:55:16.000Z | tweeter/cli.py | mmerickel/twitter-listener | 8909f53deaf19e835917703e5a63233516bc5440 | [
"MIT"
] | null | null | null | from cached_property import cached_property
from contextlib import contextmanager
import logging
import subparse
import sys
import yaml
from . import commands
class AbortCLI(Exception):
def __init__(self, message, code):
self.message = message
self.code = code
class App:
stdin = sys.stdin
... | 25.901786 | 72 | 0.571182 | from cached_property import cached_property
from contextlib import contextmanager
import logging
import subparse
import sys
import yaml
from . import commands
class AbortCLI(Exception):
def __init__(self, message, code):
self.message = message
self.code = code
class App:
stdin = sys.stdin
... | true | true |
1c1c127cd460f62a024b10e7e44fa0032e12fb80 | 35,131 | py | Python | superviser/sites.py | ynntech/tu-line-covid19 | 7ab7ba02a243f267909f6b24705d318870820a8b | [
"MIT"
] | 1 | 2021-10-15T12:53:34.000Z | 2021-10-15T12:53:34.000Z | superviser/sites.py | ynntech/tu-line-covid19 | 7ab7ba02a243f267909f6b24705d318870820a8b | [
"MIT"
] | 1 | 2020-04-11T00:35:49.000Z | 2020-04-11T00:35:49.000Z | superviser/sites.py | ynntech/tu-line-covid19 | 7ab7ba02a243f267909f6b24705d318870820a8b | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
import os
import re
import datetime
from collections import defaultdict
from utils import News, Site
### 全学生向け ###
class TUNews(News):
def __init__(self, tag, base_url):
'''
<parameter>
tag (bs4.element.Tag) : single topic object
'''
self.tag = tag
... | 35.343058 | 119 | 0.565768 |
import os
import re
import datetime
from collections import defaultdict
from utils import News, Site
__init__(self, tag, base_url):
self.tag = tag
self.base_url = base_url
self.summary()
def summary(self):
contents = "".join(self.tag.text.split("(")[:-1])
time ... | true | true |
1c1c1320bc041883fbd6a2a86984e74b1726c281 | 15,822 | py | Python | build/auto/build_openmpt_release_packages_multiarch.py | sagamusix/openmpt | 6d56d9a31d99c7f9a1f024d3deeb69006117e55c | [
"BSD-3-Clause"
] | null | null | null | build/auto/build_openmpt_release_packages_multiarch.py | sagamusix/openmpt | 6d56d9a31d99c7f9a1f024d3deeb69006117e55c | [
"BSD-3-Clause"
] | null | null | null | build/auto/build_openmpt_release_packages_multiarch.py | sagamusix/openmpt | 6d56d9a31d99c7f9a1f024d3deeb69006117e55c | [
"BSD-3-Clause"
] | null | null | null | #!/usr/bin/env python3
# OpenMPT packaging script
# https://openmpt.org/
from pathlib import Path
from subprocess import Popen
from sys import executable
import os, shutil, hashlib
import sys
path7z = "C:\\Program Files\\7-Zip\\7z.exe"
pathISCC = "C:\\Program Files (x86)\\Inno Setup\\ISCC.exe"
singleThreaded = False
... | 50.874598 | 200 | 0.752497 |
from pathlib import Path
from subprocess import Popen
from sys import executable
import os, shutil, hashlib
import sys
path7z = "C:\\Program Files\\7-Zip\\7z.exe"
pathISCC = "C:\\Program Files (x86)\\Inno Setup\\ISCC.exe"
singleThreaded = False
interactive = True
for arg in sys.argv:
if arg == '--localtools':
... | true | true |
1c1c13ee643ef50f32e447c3c68143d11c6d1e98 | 276 | py | Python | tests/artificial/transf_RelativeDifference/trend_Lag1Trend/cycle_7/ar_12/test_artificial_1024_RelativeDifference_Lag1Trend_7_12_100.py | shaido987/pyaf | b9afd089557bed6b90b246d3712c481ae26a1957 | [
"BSD-3-Clause"
] | 377 | 2016-10-13T20:52:44.000Z | 2022-03-29T18:04:14.000Z | tests/artificial/transf_RelativeDifference/trend_Lag1Trend/cycle_7/ar_12/test_artificial_1024_RelativeDifference_Lag1Trend_7_12_100.py | ysdede/pyaf | b5541b8249d5a1cfdc01f27fdfd99b6580ed680b | [
"BSD-3-Clause"
] | 160 | 2016-10-13T16:11:53.000Z | 2022-03-28T04:21:34.000Z | tests/artificial/transf_RelativeDifference/trend_Lag1Trend/cycle_7/ar_12/test_artificial_1024_RelativeDifference_Lag1Trend_7_12_100.py | ysdede/pyaf | b5541b8249d5a1cfdc01f27fdfd99b6580ed680b | [
"BSD-3-Clause"
] | 63 | 2017-03-09T14:51:18.000Z | 2022-03-27T20:52:57.000Z | import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 1024 , FREQ = 'D', seed = 0, trendtype = "Lag1Trend", cycle_length = 7, transform = "RelativeDifference", sigma = 0.0, exog_count = 100, ar_order = 12); | 39.428571 | 176 | 0.742754 | import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 1024 , FREQ = 'D', seed = 0, trendtype = "Lag1Trend", cycle_length = 7, transform = "RelativeDifference", sigma = 0.0, exog_count = 100, ar_order = 12); | true | true |
1c1c1453503e8b1f57f3892a06d007f1b25371a8 | 587 | py | Python | vttes/tests/test_node.py | forgedconcordance/vttestools | 55f2b307010ec94e1fa0b5956cfac3381e28d732 | [
"MIT"
] | null | null | null | vttes/tests/test_node.py | forgedconcordance/vttestools | 55f2b307010ec94e1fa0b5956cfac3381e28d732 | [
"MIT"
] | null | null | null | vttes/tests/test_node.py | forgedconcordance/vttestools | 55f2b307010ec94e1fa0b5956cfac3381e28d732 | [
"MIT"
] | null | null | null | import vttes.tests.common as vt_common
import vttes.node as v_node
class NodeTests(vt_common.VttTstBase):
def test_node(self):
root = v_node.Node(name='Root')
self.isinstance(root, v_node.Node) # TODO Placeholder test
def test_tree(self):
root = v_node.Node(name='Root')
child... | 36.6875 | 77 | 0.667802 | import vttes.tests.common as vt_common
import vttes.node as v_node
class NodeTests(vt_common.VttTstBase):
def test_node(self):
root = v_node.Node(name='Root')
self.isinstance(root, v_node.Node)
def test_tree(self):
root = v_node.Node(name='Root')
child1 = v_node.Node(name='C... | true | true |
1c1c14a3cab10de7260746e9d59ee3f341ab52e9 | 4,418 | py | Python | tests/test_continuation.py | abeyerpath/Snowfakery | 98d04862f2e7638486cf38eb9e9fdb12b38e391e | [
"BSD-3-Clause"
] | 81 | 2020-03-23T21:43:16.000Z | 2022-03-21T06:24:19.000Z | tests/test_continuation.py | abeyerpath/Snowfakery | 98d04862f2e7638486cf38eb9e9fdb12b38e391e | [
"BSD-3-Clause"
] | 348 | 2020-04-08T13:33:15.000Z | 2022-03-27T04:02:56.000Z | tests/test_continuation.py | abeyerpath/Snowfakery | 98d04862f2e7638486cf38eb9e9fdb12b38e391e | [
"BSD-3-Clause"
] | 20 | 2020-04-15T20:04:30.000Z | 2022-03-16T16:52:04.000Z | from unittest import mock
from io import StringIO
from snowfakery.data_generator import generate
class TestContinuation:
def test_nicknames_persist(self, generated_rows):
yaml = """
- object: foo
nickname: Foo
just_once: True
fields:
A... | 33.984615 | 84 | 0.554097 | from unittest import mock
from io import StringIO
from snowfakery.data_generator import generate
class TestContinuation:
def test_nicknames_persist(self, generated_rows):
yaml = """
- object: foo
nickname: Foo
just_once: True
fields:
A... | true | true |
1c1c1628f8a8208c82c17eafbdb5211b28b640c3 | 13,745 | py | Python | ryu/app/spr_10.py | shivamtyagi18/Ryu_Shortest_Path | dcfbb60622f41de1d70b1ec9b93078846443c447 | [
"Apache-2.0"
] | null | null | null | ryu/app/spr_10.py | shivamtyagi18/Ryu_Shortest_Path | dcfbb60622f41de1d70b1ec9b93078846443c447 | [
"Apache-2.0"
] | null | null | null | ryu/app/spr_10.py | shivamtyagi18/Ryu_Shortest_Path | dcfbb60622f41de1d70b1ec9b93078846443c447 | [
"Apache-2.0"
] | null | null | null | from ryu.base import app_manager
from ryu.controller import ofp_event
from ryu.controller.handler import CONFIG_DISPATCHER, MAIN_DISPATCHER, DEAD_DISPATCHER
from ryu.controller.handler import set_ev_cls
from ryu.ofproto import ofproto_v1_0
from ryu.lib.packet import packet
from ryu.lib.packet import etherne... | 37.249322 | 106 | 0.544489 | from ryu.base import app_manager
from ryu.controller import ofp_event
from ryu.controller.handler import CONFIG_DISPATCHER, MAIN_DISPATCHER, DEAD_DISPATCHER
from ryu.controller.handler import set_ev_cls
from ryu.ofproto import ofproto_v1_0
from ryu.lib.packet import packet
from ryu.lib.packet import etherne... | true | true |
1c1c16c5015f16baca44c126e15e83a13c85ab3d | 3,520 | py | Python | gateway/utils/data_validator.py | TransactPRO/gw3-python-client | 77a9395c13f75467385227461b57ce85f4730ce5 | [
"MIT"
] | 1 | 2018-03-13T00:10:05.000Z | 2018-03-13T00:10:05.000Z | gateway/utils/data_validator.py | TransactPRO/gw3-python-client | 77a9395c13f75467385227461b57ce85f4730ce5 | [
"MIT"
] | 1 | 2020-08-05T08:25:14.000Z | 2020-08-05T08:25:14.000Z | gateway/utils/data_validator.py | TransactPRO/gw3-python-client | 77a9395c13f75467385227461b57ce85f4730ce5 | [
"MIT"
] | null | null | null | # The MIT License
#
# Copyright (c) 2017 Transact Pro.
#
# 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, m... | 40.45977 | 109 | 0.615341 |
class DataValidator:
EXCLUDED_DATA_KEYS = [
'general-data'
]
def validate_request_data(self, required_data, request_data):
result = {}
yielded_list = list(self.__search_and_validate(req_struct=required_data, source_struct=request_data))
try:
... | true | true |
1c1c17f48cfe5388ccf5aea5530f7f78f98b2702 | 1,620 | py | Python | tests/kyu_8_tests/test_alternating_case.py | the-zebulan/CodeWars | 1eafd1247d60955a5dfb63e4882e8ce86019f43a | [
"MIT"
] | 40 | 2016-03-09T12:26:20.000Z | 2022-03-23T08:44:51.000Z | tests/kyu_8_tests/test_alternating_case.py | akalynych/CodeWars | 1eafd1247d60955a5dfb63e4882e8ce86019f43a | [
"MIT"
] | null | null | null | tests/kyu_8_tests/test_alternating_case.py | akalynych/CodeWars | 1eafd1247d60955a5dfb63e4882e8ce86019f43a | [
"MIT"
] | 36 | 2016-11-07T19:59:58.000Z | 2022-03-31T11:18:27.000Z | import unittest
from katas.kyu_8.alternating_case import to_alternating_case
class AlternatingCaseTestCase(unittest.TestCase):
def test_equals(self):
self.assertEqual(to_alternating_case('hello world'), 'HELLO WORLD')
def test_equals_2(self):
self.assertEqual(to_alternating_case('HELLO WORLD... | 30.566038 | 75 | 0.660494 | import unittest
from katas.kyu_8.alternating_case import to_alternating_case
class AlternatingCaseTestCase(unittest.TestCase):
def test_equals(self):
self.assertEqual(to_alternating_case('hello world'), 'HELLO WORLD')
def test_equals_2(self):
self.assertEqual(to_alternating_case('HELLO WORLD... | true | true |
1c1c189f0d1fcfe10a10688d83d422476aeca638 | 40 | py | Python | forum_backend/forum/auth0/urls.py | xxki99/Forum_Django-React | 0c4d3861761f5daf775d661b64d6852b5e0f7222 | [
"MIT"
] | null | null | null | forum_backend/forum/auth0/urls.py | xxki99/Forum_Django-React | 0c4d3861761f5daf775d661b64d6852b5e0f7222 | [
"MIT"
] | null | null | null | forum_backend/forum/auth0/urls.py | xxki99/Forum_Django-React | 0c4d3861761f5daf775d661b64d6852b5e0f7222 | [
"MIT"
] | null | null | null | from django.urls import path, include
| 10 | 37 | 0.775 | from django.urls import path, include
| true | true |
1c1c18c9faceeeae702be69c78ab975430aad962 | 884 | py | Python | catkin_ws2_final/src/gp_abstract_sim/src/test_string.py | Michael-E-Sami/MSSR2 | 8903ac65048a87f2843818981d21a5372e40dc55 | [
"Apache-2.0"
] | null | null | null | catkin_ws2_final/src/gp_abstract_sim/src/test_string.py | Michael-E-Sami/MSSR2 | 8903ac65048a87f2843818981d21a5372e40dc55 | [
"Apache-2.0"
] | null | null | null | catkin_ws2_final/src/gp_abstract_sim/src/test_string.py | Michael-E-Sami/MSSR2 | 8903ac65048a87f2843818981d21a5372e40dc55 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
import rospy
from std_msgs.msg import String
msg = "ditto1::body_magnet_south::box_collision#ditto2::front_face_magnet_south::box_collision"
cut = msg.split('#')
if cut[1].find('magnet') <0:
return
if cut[0].find('magnet') <0:
return
first = cut[0].split('::')
second = cut[1].split('::')... | 25.257143 | 95 | 0.677602 |
import rospy
from std_msgs.msg import String
msg = "ditto1::body_magnet_south::box_collision#ditto2::front_face_magnet_south::box_collision"
cut = msg.split('#')
if cut[1].find('magnet') <0:
return
if cut[0].find('magnet') <0:
return
first = cut[0].split('::')
second = cut[1].split('::')
first_body = first[1... | false | true |
1c1c19500cd63b4b7c3c24451f417a7449352ec5 | 168 | py | Python | ch2/Max_Recursive/test_algorithm.py | omar659/Algorithms-Sequential-Parallel-Distributed | 3543631139a20625f413cea2ba1f013f3a40d123 | [
"MIT"
] | 2 | 2020-02-19T09:27:20.000Z | 2020-02-19T09:28:21.000Z | ch2/Max_Recursive/test_algorithm.py | omar-3/Algorithms-Sequential-Parallel-Distributed | 3543631139a20625f413cea2ba1f013f3a40d123 | [
"MIT"
] | null | null | null | ch2/Max_Recursive/test_algorithm.py | omar-3/Algorithms-Sequential-Parallel-Distributed | 3543631139a20625f413cea2ba1f013f3a40d123 | [
"MIT"
] | null | null | null | from algorithm import MAX
def test1():
L = [1,5,2,9,10,2,329,1,4]
assert MAX(L) == 329
def test2():
L = [-10,-20,-343,-10,-3,-123]
assert MAX(L) == -3 | 18.666667 | 34 | 0.529762 | from algorithm import MAX
def test1():
L = [1,5,2,9,10,2,329,1,4]
assert MAX(L) == 329
def test2():
L = [-10,-20,-343,-10,-3,-123]
assert MAX(L) == -3 | true | true |
1c1c19a34d863cb2c9f576ac7f2a6161262e7b3d | 340 | py | Python | python/autori.py | twirrim/kattis | 7e060286ca301ecff7649872c25ec8b5139e066d | [
"Unlicense"
] | null | null | null | python/autori.py | twirrim/kattis | 7e060286ca301ecff7649872c25ec8b5139e066d | [
"Unlicense"
] | null | null | null | python/autori.py | twirrim/kattis | 7e060286ca301ecff7649872c25ec8b5139e066d | [
"Unlicense"
] | null | null | null | #!/usr/bin/env python3
""" Solving the Atori problem on Kattis """
# I'm not happy with this, but I think it meets requirements
# There are too many edge cases going on here, it feels like.
import sys
data = sys.stdin.read().strip()
authors = data.split("-")
result = ""
for name in authors:
result = result+nam... | 18.888889 | 61 | 0.688235 |
# There are too many edge cases going on here, it feels like.
import sys
data = sys.stdin.read().strip()
authors = data.split("-")
result = ""
for name in authors:
result = result+name[0]
print(result)
| true | true |
1c1c19efbf6eae58a6d974270920ef771546ba6d | 585 | py | Python | grr/server/grr_response_server/data_stores/fake_data_store_test.py | dekoder/grr | 27ba38dc0f5ad4f3e0cdbfb146a0a789e3b0d27b | [
"Apache-2.0"
] | 3 | 2018-09-30T01:31:29.000Z | 2019-04-22T11:44:54.000Z | grr/server/grr_response_server/data_stores/fake_data_store_test.py | tomchop/grr | 27ba38dc0f5ad4f3e0cdbfb146a0a789e3b0d27b | [
"Apache-2.0"
] | 1 | 2022-03-02T09:58:05.000Z | 2022-03-02T09:58:05.000Z | grr/server/grr_response_server/data_stores/fake_data_store_test.py | tomchop/grr | 27ba38dc0f5ad4f3e0cdbfb146a0a789e3b0d27b | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
"""Tests the fake data store - in memory implementation."""
from __future__ import unicode_literals
from grr_response_core.lib import flags
from grr_response_server import data_store_test
from grr.test_lib import test_lib
class FakeDataStoreTest(data_store_test.DataStoreTestMixin,
... | 23.4 | 80 | 0.733333 |
from __future__ import unicode_literals
from grr_response_core.lib import flags
from grr_response_server import data_store_test
from grr.test_lib import test_lib
class FakeDataStoreTest(data_store_test.DataStoreTestMixin,
test_lib.GRRBaseTest):
def testApi(self):
def main(args):
test... | true | true |
1c1c1a1fcbc1fa60f38d15605e6686460e2c45dd | 2,386 | py | Python | pythonlibs/mantis/trade/constants.py | adoggie/Tibet.6 | 3c53060edafd80b9c4dafa10699a68d86a410c66 | [
"MIT"
] | 22 | 2019-10-28T07:28:12.000Z | 2022-03-19T15:36:41.000Z | pythonlibs/mantis/trade/constants.py | adoggie/Tibet.6 | 3c53060edafd80b9c4dafa10699a68d86a410c66 | [
"MIT"
] | 1 | 2019-11-07T04:54:14.000Z | 2019-11-07T07:12:48.000Z | pythonlibs/mantis/trade/constants.py | adoggie/Tibet.6 | 3c53060edafd80b9c4dafa10699a68d86a410c66 | [
"MIT"
] | 13 | 2019-10-28T07:29:07.000Z | 2021-11-03T06:53:12.000Z | # coding:utf-8
# CommandChannelTradeAdapterGet = 'trade.command.channel.adapters.{account}.read' # 交易适配器接收通道
# CommandChannelTradeAdapterWRITE = 'trade.command.channel.adapters.{account}.write' # 策略运行器接收通道 (广播接收)
#服务程序的命令接收和发送消息的通道地址
ServiceCommandChannelAddressGet = 'redis/trade.command.channel.{service_type}.{... | 45.884615 | 114 | 0.80637 |
essGet = 'redis/trade.command.channel.{service_type}.{service_id}.get/queue'
ServiceCommandChannelAddressSub = 'redis/trade.command.channel.{service_type}.{service_id}.sub/pubsub'
ServiceCommandChannelAddressPut = 'redis/trade.command.channel.{service_type}.{service_id}.put/queue'
ServiceCommandChannelAddressPub = '... | true | true |
1c1c1a5945c8aab77e6a605cbecd924037508873 | 740 | py | Python | src/openfermion/third_party/__init__.py | qumoptly/OpenFermion | 9851b393698da29b63229e0f8457578ac5675a01 | [
"Apache-2.0"
] | 1 | 2020-05-22T17:28:42.000Z | 2020-05-22T17:28:42.000Z | src/openfermion/third_party/__init__.py | qumoptly/OpenFermion | 9851b393698da29b63229e0f8457578ac5675a01 | [
"Apache-2.0"
] | null | null | null | src/openfermion/third_party/__init__.py | qumoptly/OpenFermion | 9851b393698da29b63229e0f8457578ac5675a01 | [
"Apache-2.0"
] | null | null | null | # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distribu... | 46.25 | 76 | 0.763514 |
from openfermion.third_party.representability._higham import (
fixed_trace_positive_projection, map_to_tensor, map_to_matrix,
higham_polynomial, higham_root, heaviside)
| true | true |
1c1c1a9c893aef3d589032b1bda1f1b21235ae2d | 4,926 | py | Python | src/google-classroom-extractor/edfi_google_classroom_extractor/mapping/users.py | stephenfuqua/Ed-Fi-X-Fizz | 94597eda585d4f62f69c12e2a58fa8e8846db11b | [
"Apache-2.0"
] | 3 | 2021-06-10T16:27:18.000Z | 2022-01-25T18:41:35.000Z | src/google-classroom-extractor/edfi_google_classroom_extractor/mapping/users.py | stephenfuqua/Ed-Fi-X-Fizz | 94597eda585d4f62f69c12e2a58fa8e8846db11b | [
"Apache-2.0"
] | 40 | 2020-08-17T21:08:33.000Z | 2021-02-02T19:56:09.000Z | src/google-classroom-extractor/edfi_google_classroom_extractor/mapping/users.py | stephenfuqua/Ed-Fi-X-Fizz | 94597eda585d4f62f69c12e2a58fa8e8846db11b | [
"Apache-2.0"
] | 10 | 2021-06-10T16:27:27.000Z | 2021-12-27T12:31:57.000Z | # SPDX-License-Identifier: Apache-2.0
# Licensed to the Ed-Fi Alliance under one or more agreements.
# The Ed-Fi Alliance licenses this file to you under the Apache License, Version 2.0.
# See the LICENSE and NOTICES files in the project root for more information.
from pandas import DataFrame, concat
from edfi_google_... | 37.318182 | 108 | 0.707471 |
from pandas import DataFrame, concat
from edfi_google_classroom_extractor.mapping.constants import SOURCE_SYSTEM
STUDENT_USER_ROLE = "Student"
TEACHER_USER_ROLE = "Teacher"
def _students_or_teachers_to_users_df(
students_or_teachers_df: DataFrame, lms_udm_user_role: str
) -> DataFrame:
assert "userId" ... | true | true |
1c1c1aaffd3ebf234495077bd5e861b357f74c05 | 1,922 | py | Python | asdc/tests/test_detect.py | jancervenka/airbus-ship-detection | 87cb1c786182afa248a324f65b23153aa998e6ae | [
"MIT"
] | 3 | 2020-06-02T11:46:24.000Z | 2020-12-15T23:30:51.000Z | asdc/tests/test_detect.py | jancervenka/airbus-ship-detection | 87cb1c786182afa248a324f65b23153aa998e6ae | [
"MIT"
] | 2 | 2021-08-25T14:50:24.000Z | 2021-11-10T19:57:14.000Z | asdc/tests/test_detect.py | jancervenka/airbus-ship-detection | 87cb1c786182afa248a324f65b23153aa998e6ae | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# 2020, Jan Cervenka
import json
from unittest import TestCase, mock, main
from .utils import MockRedis
from ..service.detect import process_request, store_get, store_push
class StorePushTest(TestCase):
"""
Tests `detect.store_push` function.
"""
def tes... | 23.156627 | 67 | 0.615505 |
import json
from unittest import TestCase, mock, main
from .utils import MockRedis
from ..service.detect import process_request, store_get, store_push
class StorePushTest(TestCase):
def test_store_push(self):
db = MockRedis()
test_case_image_b64 = 'test'
store_push(db, test_case_imag... | true | true |
1c1c1ac328e213b22b37bfaab81a77b38f5196de | 649 | py | Python | users/models.py | PrinceS17/Crypcy | e190371b320d6da7c036e9fa7d5e3bfa8a58cf4b | [
"MIT"
] | null | null | null | users/models.py | PrinceS17/Crypcy | e190371b320d6da7c036e9fa7d5e3bfa8a58cf4b | [
"MIT"
] | 9 | 2020-02-12T00:00:41.000Z | 2022-03-11T23:46:39.000Z | users/models.py | PrinceS17/Crypcy | e190371b320d6da7c036e9fa7d5e3bfa8a58cf4b | [
"MIT"
] | null | null | null | from django.db import models
from django.contrib.auth.models import AbstractUser
from maker.models import CryptoCurrency
class CustomUser(AbstractUser):
name = models.CharField(max_length=200, null=True, blank=True)
gender = models.CharField(max_length=200, null=True, blank=True)
interest_tag = models.Char... | 46.357143 | 127 | 0.755008 | from django.db import models
from django.contrib.auth.models import AbstractUser
from maker.models import CryptoCurrency
class CustomUser(AbstractUser):
name = models.CharField(max_length=200, null=True, blank=True)
gender = models.CharField(max_length=200, null=True, blank=True)
interest_tag = models.Char... | true | true |
1c1c1b238f1b57422d7e8dca9c5ea9b529f437ef | 49,550 | py | Python | python/ccxt/async_support/anxpro.py | cod3gen/ccxt | a7321f49c7c3963b7a0f3e3cfc241c769cc7034b | [
"MIT"
] | 1 | 2019-05-12T10:19:08.000Z | 2019-05-12T10:19:08.000Z | python/ccxt/async_support/anxpro.py | cod3gen/ccxt | a7321f49c7c3963b7a0f3e3cfc241c769cc7034b | [
"MIT"
] | null | null | null | python/ccxt/async_support/anxpro.py | cod3gen/ccxt | a7321f49c7c3963b7a0f3e3cfc241c769cc7034b | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
# https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
from ccxt.async_support.base.exchange import Exchange
import base64
import hashlib
import math
from ccxt.base.errors import ExchangeError
f... | 42.495712 | 135 | 0.472896 |
rt.base.exchange import Exchange
import base64
import hashlib
import math
from ccxt.base.errors import ExchangeError
from ccxt.base.errors import AuthenticationError
from ccxt.base.errors import BadRequest
from ccxt.base.errors import InsufficientFunds
from ccxt.base.errors import InvalidOrder
from ccxt.base.errors ... | true | true |
1c1c1c0c2c8f21c2c1e2f73db12c546529cb7cf6 | 1,544 | py | Python | pyls/plugins/signature.py | cbosdo/python-language-server | a20b9dfa15e8eff4384caa911873587271efb674 | [
"MIT"
] | 1 | 2020-10-01T18:40:14.000Z | 2020-10-01T18:40:14.000Z | pyls/plugins/signature.py | cbosdo/python-language-server | a20b9dfa15e8eff4384caa911873587271efb674 | [
"MIT"
] | 2 | 2022-02-19T06:28:08.000Z | 2022-02-27T10:15:43.000Z | pyls/plugins/signature.py | cbosdo/python-language-server | a20b9dfa15e8eff4384caa911873587271efb674 | [
"MIT"
] | 1 | 2019-10-08T21:46:10.000Z | 2019-10-08T21:46:10.000Z | # Copyright 2017 Palantir Technologies, Inc.
import logging
import re
from pyls import hookimpl, _utils
log = logging.getLogger(__name__)
SPHINX = re.compile(r"\s*:param\s+(?P<param>\w+):\s*(?P<doc>[^\n]+)")
EPYDOC = re.compile(r"\s*@param\s+(?P<param>\w+):\s*(?P<doc>[^\n]+)")
GOOGLE = re.compile(r"\s*(?P<param>\w+).... | 28.592593 | 80 | 0.60557 |
import logging
import re
from pyls import hookimpl, _utils
log = logging.getLogger(__name__)
SPHINX = re.compile(r"\s*:param\s+(?P<param>\w+):\s*(?P<doc>[^\n]+)")
EPYDOC = re.compile(r"\s*@param\s+(?P<param>\w+):\s*(?P<doc>[^\n]+)")
GOOGLE = re.compile(r"\s*(?P<param>\w+).*:\s*(?P<doc>[^\n]+)")
DOC_REGEX = [SPHINX,... | true | true |
1c1c1c5fd5e8624c1cee3ef1f0c213e754ae6d1d | 23,397 | py | Python | qa/rpc-tests/test_framework/util.py | hexxcoin/wallet | 49fae4643a44310e72f2a38574f95527e51cb025 | [
"MIT"
] | 1 | 2018-08-08T03:58:59.000Z | 2018-08-08T03:58:59.000Z | qa/rpc-tests/test_framework/util.py | bitcoinzerox/bitcoinzerox | 0e0208392abf49bee6d7cbaae4302cb24c1dc816 | [
"MIT"
] | null | null | null | qa/rpc-tests/test_framework/util.py | bitcoinzerox/bitcoinzerox | 0e0208392abf49bee6d7cbaae4302cb24c1dc816 | [
"MIT"
] | 3 | 2018-06-24T15:07:13.000Z | 2018-11-07T23:33:50.000Z | #!/usr/bin/env python3
# Copyright (c) 2014-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Helpful routines for regression testing
#
import os
import sys
from binascii import hexlify, unhex... | 35.775229 | 125 | 0.652605 |
import os
import sys
from binascii import hexlify, unhexlify
from base64 import b64encode
from decimal import Decimal, ROUND_DOWN
import json
import http.client
import random
import shutil
import subprocess
import time
import re
import errno
from . import coverage
from .authproxy import AuthServiceProxy, JS... | true | true |
1c1c1d3ecde083d65c16da0b0bf822f553950519 | 1,746 | py | Python | exl_env/lib/python3.6/site-packages/imblearn/utils/tests/test_testing.py | verma-varsha/fraud-detection | 13c5b0c274dfa2b68e82a4ee317e09223b5b663f | [
"MIT"
] | 25 | 2016-10-08T10:19:35.000Z | 2021-11-10T09:52:11.000Z | imblearn/utils/tests/test_testing.py | eavgerinos/pkg-imbalanced-learn | 3e875838cb602865d8b9786fbe940d0704771fca | [
"MIT"
] | 2 | 2016-05-23T09:42:33.000Z | 2016-07-05T13:27:06.000Z | imblearn/utils/tests/test_testing.py | eavgerinos/pkg-imbalanced-learn | 3e875838cb602865d8b9786fbe940d0704771fca | [
"MIT"
] | 13 | 2017-02-17T00:58:22.000Z | 2020-12-28T02:50:45.000Z | """Test for the testing module"""
# Authors: Guillaume Lemaitre <g.lemaitre58@gmail.com>
# Christos Aridas
# License: MIT
from pytest import raises
from imblearn.base import SamplerMixin
from imblearn.utils.testing import all_estimators
from imblearn.utils.testing import warns
def test_all_estimators():
... | 34.235294 | 77 | 0.687285 |
from pytest import raises
from imblearn.base import SamplerMixin
from imblearn.utils.testing import all_estimators
from imblearn.utils.testing import warns
def test_all_estimators():
type_filter = 'sampler'
all_estimators(type_filter=type_filter)
type_filter = ['sampler']
estimators = all_e... | true | true |
1c1c1dcb872d904e6a0fc176b2ceece20042ee8e | 4,667 | py | Python | sdk/formrecognizer/azure-ai-formrecognizer/samples/sample_authentication.py | iscai-msft/azure-sdk-for-python | 83715b95c41e519d5be7f1180195e2fba136fc0f | [
"MIT"
] | 8 | 2021-01-13T23:44:08.000Z | 2021-03-17T10:13:36.000Z | sdk/formrecognizer/azure-ai-formrecognizer/samples/sample_authentication.py | iscai-msft/azure-sdk-for-python | 83715b95c41e519d5be7f1180195e2fba136fc0f | [
"MIT"
] | 15 | 2019-07-12T18:18:04.000Z | 2019-07-25T20:55:51.000Z | sdk/formrecognizer/azure-ai-formrecognizer/samples/sample_authentication.py | iscai-msft/azure-sdk-for-python | 83715b95c41e519d5be7f1180195e2fba136fc0f | [
"MIT"
] | 2 | 2020-05-21T22:51:22.000Z | 2020-05-26T20:53:01.000Z | # coding: utf-8
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------... | 45.754902 | 169 | 0.747161 |
import os
class AuthenticationSample(object):
url = "https://raw.githubusercontent.com/Azure/azure-sdk-for-python/master/sdk/formrecognizer/azure-ai-formrecognizer/tests/sample_forms/receipt/contoso-receipt.png"
def authentication_with_api_key_credential_form_recognizer_client(self):
... | true | true |
1c1c1ec7bc10537a29db93b50aac0501e43ba2fd | 271 | py | Python | terrascript/gridscale/__init__.py | mjuenema/python-terrascript | 6d8bb0273a14bfeb8ff8e950fe36f97f7c6e7b1d | [
"BSD-2-Clause"
] | 507 | 2017-07-26T02:58:38.000Z | 2022-01-21T12:35:13.000Z | terrascript/gridscale/__init__.py | mjuenema/python-terrascript | 6d8bb0273a14bfeb8ff8e950fe36f97f7c6e7b1d | [
"BSD-2-Clause"
] | 135 | 2017-07-20T12:01:59.000Z | 2021-10-04T22:25:40.000Z | terrascript/gridscale/__init__.py | mjuenema/python-terrascript | 6d8bb0273a14bfeb8ff8e950fe36f97f7c6e7b1d | [
"BSD-2-Clause"
] | 81 | 2018-02-20T17:55:28.000Z | 2022-01-31T07:08:40.000Z | # terrascript/gridscale/__init__.py
# Automatically generated by tools/makecode.py ()
import warnings
warnings.warn(
"using the 'legacy layout' is deprecated", DeprecationWarning, stacklevel=2
)
import terrascript
class gridscale(terrascript.Provider):
pass
| 18.066667 | 79 | 0.774908 |
import warnings
warnings.warn(
"using the 'legacy layout' is deprecated", DeprecationWarning, stacklevel=2
)
import terrascript
class gridscale(terrascript.Provider):
pass
| true | true |
1c1c1eeba169ce683cd65d6748dde8735253e86e | 2,868 | py | Python | python/jittor/test/test_custom_op.py | wanghonghui1998/jittor | 9f3c97a605be8eecda84fb4b5786706fe0096729 | [
"Apache-2.0"
] | 1 | 2020-11-13T10:08:00.000Z | 2020-11-13T10:08:00.000Z | python/jittor/test/test_custom_op.py | wanghonghui1998/jittor | 9f3c97a605be8eecda84fb4b5786706fe0096729 | [
"Apache-2.0"
] | null | null | null | python/jittor/test/test_custom_op.py | wanghonghui1998/jittor | 9f3c97a605be8eecda84fb4b5786706fe0096729 | [
"Apache-2.0"
] | null | null | null | # ***************************************************************
# Copyright (c) 2020 Jittor. Authors: Dun Liang <randonlang@gmail.com>. All Rights Reserved.
# This file is subject to the terms and conditions defined in
# file 'LICENSE.txt', which is part of this source code package.
# ********************************... | 26.072727 | 92 | 0.543584 |
import unittest
import os
import jittor as jt
from .test_core import expect_error
header ="""
#pragma once
#include "op.h"
namespace jittor {
struct CustomOp : Op {
Var* output;
CustomOp(NanoVector shape, NanoString dtype=ns_float32);
const char* name() const override { return "custom"; }
D... | true | true |
1c1c1f30525bb76f92404e5e2a91ce44a8c7d122 | 1,485 | py | Python | torch_glow/tests/nodes/quantized_relu_test.py | saranyakrish14/glow | 3562fba6a77d2bb4aacf98a5bff5a737a93f6adc | [
"Apache-2.0"
] | null | null | null | torch_glow/tests/nodes/quantized_relu_test.py | saranyakrish14/glow | 3562fba6a77d2bb4aacf98a5bff5a737a93f6adc | [
"Apache-2.0"
] | null | null | null | torch_glow/tests/nodes/quantized_relu_test.py | saranyakrish14/glow | 3562fba6a77d2bb4aacf98a5bff5a737a93f6adc | [
"Apache-2.0"
] | null | null | null | from __future__ import absolute_import, division, print_function, unicode_literals
import torch
from tests import utils
class SimpleQuantizedReluModel(torch.nn.Module):
def __init__(self, scale, zero_point, dtype):
super(SimpleQuantizedReluModel, self).__init__()
self.scale = scale
self.z... | 35.357143 | 108 | 0.657912 | from __future__ import absolute_import, division, print_function, unicode_literals
import torch
from tests import utils
class SimpleQuantizedReluModel(torch.nn.Module):
def __init__(self, scale, zero_point, dtype):
super(SimpleQuantizedReluModel, self).__init__()
self.scale = scale
self.z... | true | true |
1c1c1f99c3327c54cfa67995fb0b424cdcaecbbc | 3,453 | py | Python | tests/test_examples.py | benhoff/rasa_core | 69c9d2215c327735096728a9ede0c9fdae6212d8 | [
"Apache-2.0"
] | null | null | null | tests/test_examples.py | benhoff/rasa_core | 69c9d2215c327735096728a9ede0c9fdae6212d8 | [
"Apache-2.0"
] | null | null | null | tests/test_examples.py | benhoff/rasa_core | 69c9d2215c327735096728a9ede0c9fdae6212d8 | [
"Apache-2.0"
] | 1 | 2018-10-02T06:03:44.000Z | 2018-10-02T06:03:44.000Z | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import sys
import os
from rasa_core.channels.file import FileInputChannel
from rasa_core.interpreter import RegexInterpreter
def test_moodbot_example():
from rasa... | 37.129032 | 80 | 0.617724 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import sys
import os
from rasa_core.channels.file import FileInputChannel
from rasa_core.interpreter import RegexInterpreter
def test_moodbot_example():
from rasa... | true | true |
1c1c1fb011224b11983c8f8f107baa7761159d1a | 7,187 | py | Python | qrxfer.py | konstantingoretzki/qrxfer | a9900527beeb9903b2de4975ccd67d58a10f9d3b | [
"MIT"
] | 1 | 2021-09-10T05:38:20.000Z | 2021-09-10T05:38:20.000Z | qrxfer.py | konstantingoretzki/qrxfer | a9900527beeb9903b2de4975ccd67d58a10f9d3b | [
"MIT"
] | null | null | null | qrxfer.py | konstantingoretzki/qrxfer | a9900527beeb9903b2de4975ccd67d58a10f9d3b | [
"MIT"
] | 1 | 2022-02-10T08:02:55.000Z | 2022-02-10T08:02:55.000Z | #!/usr/bin/env python3
# The MIT License (MIT)
#
# Copyright (c) 2021 Konstantin Goretzki
# Copyright (c) 2016 Leon Jacobs
#
# 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 restricti... | 29.821577 | 115 | 0.592876 |
import base64
import hashlib
import time
import click
import cv2
import pyqrcode
from pyzbar.pyzbar import decode
MESSAGE_BEGIN = '-----BEGIN XFER MESSAGE-----'
MESSAGE_END = '-----END XFER MESSAGE-----'
HEADER_BEGIN = '-----BEGIN XFER HEADER-----'
HEADER_END = '-----END XFER HEADER-----'
c... | true | true |
1c1c2027b0f585595760661ed981291de812c256 | 2,713 | py | Python | tokana.py | attilammagyar/jp-flashcards | 77e28a1de3dff3ae6869c0d5a79e84f1c59d5f7e | [
"BSD-3-Clause"
] | 1 | 2020-07-06T17:43:00.000Z | 2020-07-06T17:43:00.000Z | tokana.py | attilammagyar/jp-flashcards | 77e28a1de3dff3ae6869c0d5a79e84f1c59d5f7e | [
"BSD-3-Clause"
] | null | null | null | tokana.py | attilammagyar/jp-flashcards | 77e28a1de3dff3ae6869c0d5a79e84f1c59d5f7e | [
"BSD-3-Clause"
] | null | null | null | import sys
import re
import romkan
import unittest
def to_kana(text):
formatted = ""
text = text.strip()
is_katakana = False
is_roman = False
for part in re.split("([_*])", text):
if part == "_":
is_katakana = not is_katakana
continue
if part == "*":
... | 27.13 | 112 | 0.479912 | import sys
import re
import romkan
import unittest
def to_kana(text):
formatted = ""
text = text.strip()
is_katakana = False
is_roman = False
for part in re.split("([_*])", text):
if part == "_":
is_katakana = not is_katakana
continue
if part == "*":
... | true | true |
1c1c20e98c5d0c6ee2e0979d3d85349a66923102 | 208 | py | Python | 11_Day_Functions/20.py | diegofregolente/30-Days-Of-Python | e0cad31f6d5ab1384ad6fa5a5d24a84771d6c267 | [
"Apache-2.0"
] | null | null | null | 11_Day_Functions/20.py | diegofregolente/30-Days-Of-Python | e0cad31f6d5ab1384ad6fa5a5d24a84771d6c267 | [
"Apache-2.0"
] | null | null | null | 11_Day_Functions/20.py | diegofregolente/30-Days-Of-Python | e0cad31f6d5ab1384ad6fa5a5d24a84771d6c267 | [
"Apache-2.0"
] | null | null | null | def prime(n):
cont = 0
for c in range(1, n+1):
if n % c == 0:
cont += 1
if cont == 2:
return f'{n} is prime'
else:
return f'{n} not prime'
print(prime(6))
| 17.333333 | 31 | 0.4375 | def prime(n):
cont = 0
for c in range(1, n+1):
if n % c == 0:
cont += 1
if cont == 2:
return f'{n} is prime'
else:
return f'{n} not prime'
print(prime(6))
| true | true |
1c1c229236ad036479903fc7fc6a8eaae09ccf02 | 585 | py | Python | 2020/06/06.py | nhtsai/advent-of-code | d79ec16eb9014acc766805e9d922168aaa2809de | [
"MIT"
] | null | null | null | 2020/06/06.py | nhtsai/advent-of-code | d79ec16eb9014acc766805e9d922168aaa2809de | [
"MIT"
] | null | null | null | 2020/06/06.py | nhtsai/advent-of-code | d79ec16eb9014acc766805e9d922168aaa2809de | [
"MIT"
] | null | null | null | def part1(l):
return sum([len(set([x for x in p.replace("\n", "")])) for p in l])
def part2(l):
# yes = 0
# for p in l:
# ppl = p.strip().count("\n") + 1
# for s in set(list(p.replace("\n", ""))):
# if p.count(s) == ppl:
# yes += 1
# return yes
return sum... | 30.789474 | 115 | 0.468376 | def part1(l):
return sum([len(set([x for x in p.replace("\n", "")])) for p in l])
def part2(l):
return sum([sum([p.count(s) == p.strip().count("\n") + 1 for s in set(list(p.replace("\n", "")))]) for p in l])
if __name__ == '__main__':
with open('input.txt', 'r') as f:
... | true | true |
1c1c24f9420fa09f271d3cf18d41f086de00aaa6 | 1,506 | py | Python | tests/t_debug_toolbar/tests.py | stefanfoulis/django-salesforce | d7ef1960aa4c162fc41c380c6ae91465db799f2a | [
"MIT"
] | null | null | null | tests/t_debug_toolbar/tests.py | stefanfoulis/django-salesforce | d7ef1960aa4c162fc41c380c6ae91465db799f2a | [
"MIT"
] | null | null | null | tests/t_debug_toolbar/tests.py | stefanfoulis/django-salesforce | d7ef1960aa4c162fc41c380c6ae91465db799f2a | [
"MIT"
] | null | null | null | """Test with django-debug-toolbar."""
from __future__ import absolute_import
from django.test import TestCase, override_settings
import django.contrib.auth
from salesforce.backend.test_helpers import uid_version as uid
from salesforce.testrunner.example.models import Campaign
@override_settings(DEBUG=True)
class Debu... | 38.615385 | 109 | 0.719788 | from __future__ import absolute_import
from django.test import TestCase, override_settings
import django.contrib.auth
from salesforce.backend.test_helpers import uid_version as uid
from salesforce.testrunner.example.models import Campaign
@override_settings(DEBUG=True)
class DebugToolbarViewTest(TestCase):
databa... | true | true |
1c1c25e754f70979ed73922e89889f94ef1fc736 | 546 | py | Python | _debug.py | MaDeuce/riprock | 73928b2f5833634c1ab46138a77c5dacf2ce0e64 | [
"MIT"
] | 2 | 2017-02-03T21:11:24.000Z | 2017-05-07T23:11:34.000Z | _debug.py | kheast/riprock | 73928b2f5833634c1ab46138a77c5dacf2ce0e64 | [
"MIT"
] | null | null | null | _debug.py | kheast/riprock | 73928b2f5833634c1ab46138a77c5dacf2ce0e64 | [
"MIT"
] | 1 | 2017-02-04T03:06:29.000Z | 2017-02-04T03:06:29.000Z | import sys
def info(type, value, tb):
if hasattr(sys, 'ps1') or not sys.stderr.isatty():
# we are in interactive mode or we don't have a tty-like
# device, so we call the default hook
sys.__excepthook__(type, value, tb)
else:
import traceback, pdb
# we are NOT in interactive mod... | 30.333333 | 61 | 0.637363 | import sys
def info(type, value, tb):
if hasattr(sys, 'ps1') or not sys.stderr.isatty():
# device, so we call the default hook
sys.__excepthook__(type, value, tb)
else:
import traceback, pdb
# we are NOT in interactive mode, print the exception
traceback.print_exception... | true | true |
1c1c2700ddcd791f2d962f603b662a4e6ce6c95a | 627 | py | Python | cfgov/v1/tests/management/commands/test_invalidate_all_pages.py | raft-tech/cfgov-refresh | 7c63c31fd6bb95ed4f7d368f1e1252175f0c71ca | [
"CC0-1.0"
] | 4 | 2020-03-19T19:32:26.000Z | 2020-06-30T11:15:00.000Z | cfgov/v1/tests/management/commands/test_invalidate_all_pages.py | raft-tech/cfgov-refresh | 7c63c31fd6bb95ed4f7d368f1e1252175f0c71ca | [
"CC0-1.0"
] | 100 | 2020-02-06T13:32:37.000Z | 2020-08-19T15:02:02.000Z | cfgov/v1/tests/management/commands/test_invalidate_all_pages.py | raft-tech/cfgov-refresh | 7c63c31fd6bb95ed4f7d368f1e1252175f0c71ca | [
"CC0-1.0"
] | null | null | null | from django.core.management import call_command
from django.test import TestCase, override_settings
import mock
@override_settings(
WAGTAILFRONTENDCACHE={
"akamai": {
"BACKEND": "v1.models.caching.AkamaiBackend",
"CLIENT_TOKEN": "fake",
"CLIENT_SECRET": "fake",
... | 28.5 | 62 | 0.682616 | from django.core.management import call_command
from django.test import TestCase, override_settings
import mock
@override_settings(
WAGTAILFRONTENDCACHE={
"akamai": {
"BACKEND": "v1.models.caching.AkamaiBackend",
"CLIENT_TOKEN": "fake",
"CLIENT_SECRET": "fake",
... | true | true |
1c1c289e59cfa181b7e80df3169928208dc47ae1 | 5,593 | py | Python | relations/routes/tests/test_api.py | arXiv/arxiv-external-links | a92e04fb4f9f50629e241de6d64e8aa8e2be6774 | [
"MIT"
] | 6 | 2019-07-22T14:39:29.000Z | 2021-11-05T12:24:36.000Z | relations/routes/tests/test_api.py | arXiv/arxiv-external-links | a92e04fb4f9f50629e241de6d64e8aa8e2be6774 | [
"MIT"
] | 24 | 2019-06-11T01:16:38.000Z | 2021-06-02T00:18:51.000Z | relations/routes/tests/test_api.py | arXiv/arxiv-external-links | a92e04fb4f9f50629e241de6d64e8aa8e2be6774 | [
"MIT"
] | 5 | 2019-06-24T21:00:37.000Z | 2021-11-05T12:24:29.000Z | """Tests for :mod:`routes.api`."""
import json
import os
from http import HTTPStatus
from typing import Any, Optional
from unittest import TestCase, mock
from datetime import datetime
import jsonschema
from flask import Flask
from arxiv.users.helpers import generate_token
from arxiv.users import auth
from arxiv.user... | 44.388889 | 178 | 0.619882 |
import json
import os
from http import HTTPStatus
from typing import Any, Optional
from unittest import TestCase, mock
from datetime import datetime
import jsonschema
from flask import Flask
from arxiv.users.helpers import generate_token
from arxiv.users import auth
from arxiv.users.domain import Scope
from relation... | true | true |
1c1c2b47469da0e2122d2774a47dc474ee07d6da | 677 | py | Python | Paths/Align to Metrics/Selection to RSB.py | tiennguyen0910/Glyphs-Scripts | fca80d684fd152dda40093c5c43586545e6518e9 | [
"Apache-2.0"
] | null | null | null | Paths/Align to Metrics/Selection to RSB.py | tiennguyen0910/Glyphs-Scripts | fca80d684fd152dda40093c5c43586545e6518e9 | [
"Apache-2.0"
] | null | null | null | Paths/Align to Metrics/Selection to RSB.py | tiennguyen0910/Glyphs-Scripts | fca80d684fd152dda40093c5c43586545e6518e9 | [
"Apache-2.0"
] | null | null | null | #MenuTitle: Align Selection to RSB
# -*- coding: utf-8 -*-
__doc__="""
Align selected paths (and parts of paths) in the frontmost layer to the RSB.
"""
Font = Glyphs.font
Doc = Glyphs.currentDocument
selectedLayer = Font.selectedLayers[0]
layerWidth = selectedLayer.width
try:
try:
# until v2.1:
selection = sel... | 19.911765 | 76 | 0.720827 |
__doc__="""
Align selected paths (and parts of paths) in the frontmost layer to the RSB.
"""
Font = Glyphs.font
Doc = Glyphs.currentDocument
selectedLayer = Font.selectedLayers[0]
layerWidth = selectedLayer.width
try:
try:
selection = selectedLayer.selection()
except:
selection = selectedLayer.selecti... | false | true |
1c1c2b479ad6680585f25c0ad2a3ef56370bc59a | 15,529 | py | Python | orchestrator/test/test_application_class.py | jrusnakli/mobile_test_orchestrator | 9dc21ed22798fc7587db538ca0e0a69d5664d03d | [
"BSD-2-Clause"
] | 1 | 2019-05-21T15:14:39.000Z | 2019-05-21T15:14:39.000Z | orchestrator/test/test_application_class.py | jrusnakli/mobile_test_orchestrator | 9dc21ed22798fc7587db538ca0e0a69d5664d03d | [
"BSD-2-Clause"
] | 17 | 2019-05-20T17:40:05.000Z | 2021-07-25T23:13:13.000Z | orchestrator/test/test_application_class.py | jrusnakli/mobile_test_orchestrator | 9dc21ed22798fc7587db538ca0e0a69d5664d03d | [
"BSD-2-Clause"
] | 7 | 2019-05-22T21:02:10.000Z | 2020-08-06T23:56:23.000Z | # flake8: noqay: F811
##########
# Tests the lower level Application class against a running emulator. These tests may
# be better server in mdl-integration-server directory, but we cannot start up an emulator
# from there
##########
import time
import subprocess
from contextlib import suppress
from unittest.mock imp... | 50.093548 | 148 | 0.626698 |
port Mock, patch, PropertyMock
import pytest
from apk_bitminer.parsing import AXMLParser
from mobiletestorchestrator.device import Device
from mobiletestorchestrator.application import Application, TestApplication, AsyncApplication, AsyncTestApplication
from .support import uninstall_apk
class MockAXMLParser(AXMLP... | true | true |
1c1c2c876b854ee472ec203048342257440c3f09 | 540 | py | Python | src/commands/math/permutations.py | Dragonsight91/RWTHufflepuffy | 2b98bd9c6854cd587704830edd5a639d1617b2ff | [
"MIT"
] | null | null | null | src/commands/math/permutations.py | Dragonsight91/RWTHufflepuffy | 2b98bd9c6854cd587704830edd5a639d1617b2ff | [
"MIT"
] | 1 | 2020-02-27T22:04:53.000Z | 2020-02-27T22:04:53.000Z | src/commands/math/permutations.py | Dragonsight91/RWTHufflepuffy | 2b98bd9c6854cd587704830edd5a639d1617b2ff | [
"MIT"
] | null | null | null | import sys
async def factorize(n):
res=1
if(n>=1):
res = n*factorize(n-1)
return res
async def get_permutations(word):
# get the word
chars = list(word)
# get the permutations
perms = await factorize(len(chars))
# group unique characters
groups = dict(zip(chars, [0 for x in chars]))
# count all charact... | 17.419355 | 47 | 0.683333 | import sys
async def factorize(n):
res=1
if(n>=1):
res = n*factorize(n-1)
return res
async def get_permutations(word):
chars = list(word)
perms = await factorize(len(chars))
groups = dict(zip(chars, [0 for x in chars]))
for char in chars:
groups[char] += 1
for group in groups.keys():
perms... | true | true |
1c1c2ce9cdd2281396104ddd762aee14b0ed60f6 | 124 | py | Python | amos/apps.py | chuckoy/grabyaya | 5fbd7135cc74bdbb29c6d86b1b202b37b94e1660 | [
"MIT"
] | null | null | null | amos/apps.py | chuckoy/grabyaya | 5fbd7135cc74bdbb29c6d86b1b202b37b94e1660 | [
"MIT"
] | null | null | null | amos/apps.py | chuckoy/grabyaya | 5fbd7135cc74bdbb29c6d86b1b202b37b94e1660 | [
"MIT"
] | null | null | null | from __future__ import unicode_literals
from django.apps import AppConfig
class AmosConfig(AppConfig):
name = 'amos'
| 15.5 | 39 | 0.782258 | from __future__ import unicode_literals
from django.apps import AppConfig
class AmosConfig(AppConfig):
name = 'amos'
| true | true |
1c1c2d9a594c8b3858128ffe76951efbef835c1a | 1,647 | py | Python | ch9/frame_grid.py | chunhua2017/pythonprogrammingdemo | 64e4ac2b33c54cde4671291a6203e94cd96de4ba | [
"MIT"
] | 4 | 2020-05-18T05:25:44.000Z | 2021-07-30T01:02:39.000Z | ch9/frame_grid.py | chunhua2017/pythonprogrammingdemo | 64e4ac2b33c54cde4671291a6203e94cd96de4ba | [
"MIT"
] | null | null | null | ch9/frame_grid.py | chunhua2017/pythonprogrammingdemo | 64e4ac2b33c54cde4671291a6203e94cd96de4ba | [
"MIT"
] | 2 | 2021-09-15T05:41:05.000Z | 2022-01-25T05:44:43.000Z | from tkinter import *
window = Tk()
window.title('Frame+Grid Complex GUI Layout')
window.geometry('460x350')
# create all of the main containers
top_frame = Frame(window, bg='cyan', width=450, height=50, pady=3)
center = Frame(window, bg='gray2', width=50, height=40, padx=3, pady=3)
btm_frame = Frame(window, bg='whit... | 34.3125 | 76 | 0.738312 | from tkinter import *
window = Tk()
window.title('Frame+Grid Complex GUI Layout')
window.geometry('460x350')
top_frame = Frame(window, bg='cyan', width=450, height=50, pady=3)
center = Frame(window, bg='gray2', width=50, height=40, padx=3, pady=3)
btm_frame = Frame(window, bg='white', width=450, height=45, pady=3)
b... | true | true |
1c1c2e3224b30deac6c2883a68a8a09dff16e3ff | 4,582 | py | Python | pandas/util/print_versions.py | clarkfitzg/pandas | a71ede374a019ea40321d8c1cfd13258b45ff58d | [
"PSF-2.0",
"Apache-2.0",
"BSD-2-Clause",
"BSD-3-Clause"
] | 1 | 2019-05-21T21:07:03.000Z | 2019-05-21T21:07:03.000Z | pandas/util/print_versions.py | josericardo/pandas | fe9aa125c19ce2b22a0c4aabedd68b24df6cb98e | [
"PSF-2.0",
"Apache-2.0",
"BSD-2-Clause",
"BSD-3-Clause"
] | null | null | null | pandas/util/print_versions.py | josericardo/pandas | fe9aa125c19ce2b22a0c4aabedd68b24df6cb98e | [
"PSF-2.0",
"Apache-2.0",
"BSD-2-Clause",
"BSD-3-Clause"
] | null | null | null | import os
import platform
import sys
import struct
import subprocess
import codecs
def get_sys_info():
"Returns system information as a dict"
blob = []
# get full commit hash
commit = None
if os.path.isdir(".git") and os.path.isdir("pandas"):
try:
pipe = subprocess.Popen('git... | 30.344371 | 92 | 0.527717 | import os
import platform
import sys
import struct
import subprocess
import codecs
def get_sys_info():
blob = []
commit = None
if os.path.isdir(".git") and os.path.isdir("pandas"):
try:
pipe = subprocess.Popen('git log --format="%H" -n 1'.split(" "),
... | true | true |
1c1c2ea2bd4b61f0c0e6d7eedc72872875764e1c | 5,395 | py | Python | David and Pooja/++Validating Linked Mods/Python-3.0/Lib/distutils/command/bdist.py | LinkedModernismProject/web_code | 4cf6bf53d5c3249e52a75f0a3f57d106e31daf9e | [
"Apache-2.0"
] | 1 | 2015-05-21T23:47:54.000Z | 2015-05-21T23:47:54.000Z | front-end/testsuite-python-lib/Python-3.0/Lib/distutils/command/bdist.py | MalloyPower/parsing-python | b2bca5eed07ea2af7a2001cd4f63becdfb0570be | [
"MIT"
] | 1 | 2015-10-29T20:51:31.000Z | 2015-10-29T20:51:31.000Z | front-end/testsuite-python-lib/Python-3.0/Lib/distutils/command/bdist.py | MalloyPower/parsing-python | b2bca5eed07ea2af7a2001cd4f63becdfb0570be | [
"MIT"
] | 1 | 2019-04-11T11:27:01.000Z | 2019-04-11T11:27:01.000Z | """distutils.command.bdist
Implements the Distutils 'bdist' command (create a built [binary]
distribution)."""
__revision__ = "$Id: bdist.py 62242 2008-04-09 08:37:03Z christian.heimes $"
import os
from distutils.core import Command
from distutils.errors import *
from distutils.util import get_platform
def show_fo... | 38.535714 | 78 | 0.538091 |
__revision__ = "$Id: bdist.py 62242 2008-04-09 08:37:03Z christian.heimes $"
import os
from distutils.core import Command
from distutils.errors import *
from distutils.util import get_platform
def show_formats():
from distutils.fancy_getopt import FancyGetopt
formats = []
for format in bdist.format_comm... | true | true |
1c1c2ebe2b7c139bf0ee423ce071507d066fddb4 | 2,494 | py | Python | app/recipe/tests/test_tags_api.py | bboti199/recipe-rest-django | c1e588aa590ad2717d2ca1ade36dbff82e2bebc4 | [
"MIT"
] | null | null | null | app/recipe/tests/test_tags_api.py | bboti199/recipe-rest-django | c1e588aa590ad2717d2ca1ade36dbff82e2bebc4 | [
"MIT"
] | null | null | null | app/recipe/tests/test_tags_api.py | bboti199/recipe-rest-django | c1e588aa590ad2717d2ca1ade36dbff82e2bebc4 | [
"MIT"
] | null | null | null | from django.contrib.auth import get_user_model
from django.urls import reverse
from django.test import TestCase
from rest_framework import status
from rest_framework.test import APIClient
from core.models import Tag
from recipe.serializers import TagSerializer
TAGS_URL = reverse('recipe:tag-list')
class PublicTag... | 28.022472 | 71 | 0.648757 | from django.contrib.auth import get_user_model
from django.urls import reverse
from django.test import TestCase
from rest_framework import status
from rest_framework.test import APIClient
from core.models import Tag
from recipe.serializers import TagSerializer
TAGS_URL = reverse('recipe:tag-list')
class PublicTag... | true | true |
1c1c2f1dc2e047594d2ae6a38058ce4d24f4305b | 88 | py | Python | music/song/apps.py | chenotsamuel/composer-catalog | 1dcba56093f9b656cecc08fe400d0244d2c926f5 | [
"MIT"
] | null | null | null | music/song/apps.py | chenotsamuel/composer-catalog | 1dcba56093f9b656cecc08fe400d0244d2c926f5 | [
"MIT"
] | null | null | null | music/song/apps.py | chenotsamuel/composer-catalog | 1dcba56093f9b656cecc08fe400d0244d2c926f5 | [
"MIT"
] | null | null | null | from django.apps import AppConfig
class SongConfig(AppConfig):
name = 'song'
| 14.666667 | 34 | 0.693182 | from django.apps import AppConfig
class SongConfig(AppConfig):
name = 'song'
| true | true |
1c1c2f736fb4de2449c63c3f4a0212dcff20ea5c | 2,095 | py | Python | pyscarphase/plot/signature.py | emosy/scarphase | 98734fe149dacccd28b00232deeb15ed43af1031 | [
"BSD-3-Clause"
] | 6 | 2016-12-03T15:18:44.000Z | 2022-01-13T06:19:01.000Z | pyscarphase/plot/signature.py | emosy/scarphase | 98734fe149dacccd28b00232deeb15ed43af1031 | [
"BSD-3-Clause"
] | 5 | 2015-07-02T15:12:18.000Z | 2021-12-08T12:50:06.000Z | pyscarphase/plot/signature.py | emosy/scarphase | 98734fe149dacccd28b00232deeb15ed43af1031 | [
"BSD-3-Clause"
] | 6 | 2015-11-04T04:12:24.000Z | 2022-03-27T16:29:24.000Z | # Copyright (c) 2011-2013 Andreas Sembrant
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# - Redistributions of source code must retain the above copyright
# notice, this list of conditi... | 38.796296 | 83 | 0.747494 |
import matplotlib.pyplot as plt
import matplotlib.cm as cmx
from pyscarphase.plot.util import phasebar
def plot_time(phase_list, signatures):
fig=plt.figure()
ax = plt.axes([0.1, 0.9, 0.8, 0.025])
phasebar.plot(ax, phase_list)
ax2 = plt.axes([0.1, 0.... | true | true |
1c1c2fb12fb3795826fccfcb38249f5ee593c724 | 110 | py | Python | Logica_de_Programacao/aula.py | brunoimpactagithub/devops-ead | 8c43334109e0c9e5d0fd57849d667c877bf93295 | [
"Apache-2.0"
] | null | null | null | Logica_de_Programacao/aula.py | brunoimpactagithub/devops-ead | 8c43334109e0c9e5d0fd57849d667c877bf93295 | [
"Apache-2.0"
] | null | null | null | Logica_de_Programacao/aula.py | brunoimpactagithub/devops-ead | 8c43334109e0c9e5d0fd57849d667c877bf93295 | [
"Apache-2.0"
] | null | null | null | #bash!
N1 = int (input ("Digite um numero: "))
N2 = int (input ("Digite o segundo numero: "))
print (N1+N2)
| 15.714286 | 46 | 0.609091 |
N1 = int (input ("Digite um numero: "))
N2 = int (input ("Digite o segundo numero: "))
print (N1+N2)
| true | true |
1c1c2fb22709189ca03dc543ca551257c8031c1a | 850 | py | Python | python/paddle/fluid/contrib/utils/__init__.py | ysh329/Paddle | 50ad9046c9a440564d104eaa354eb9df83a35678 | [
"Apache-2.0"
] | 10 | 2021-05-12T07:20:32.000Z | 2022-03-04T08:21:56.000Z | python/paddle/fluid/contrib/utils/__init__.py | AFLee/Paddle | 311b3b44fc7d51d4d66d90ab8a3fc0d42231afda | [
"Apache-2.0"
] | 1 | 2020-09-22T08:54:49.000Z | 2020-09-22T11:44:09.000Z | python/paddle/fluid/contrib/utils/__init__.py | AFLee/Paddle | 311b3b44fc7d51d4d66d90ab8a3fc0d42231afda | [
"Apache-2.0"
] | 25 | 2019-12-07T02:14:14.000Z | 2021-12-30T06:16:30.000Z | # Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve.
#
# 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... | 35.416667 | 74 | 0.774118 |
from __future__ import print_function
from . import lookup_table_utils
from .lookup_table_utils import *
from . import hdfs_utils
from .hdfs_utils import *
__all__ = []
__all__ += lookup_table_utils.__all__
__all__ += hdfs_utils.__all__
| true | true |
1c1c2fbbddcd1740734f070f7e3b61e91bdf13f5 | 575 | py | Python | src/hardware-security-modules/azext_hardware_security_modules/vendored_sdks/hardwaresecuritymodules/operations/__init__.py | Mannan2812/azure-cli-extensions | e2b34efe23795f6db9c59100534a40f0813c3d95 | [
"MIT"
] | 207 | 2017-11-29T06:59:41.000Z | 2022-03-31T10:00:53.000Z | src/hardware-security-modules/azext_hardware_security_modules/vendored_sdks/hardwaresecuritymodules/operations/__init__.py | Mannan2812/azure-cli-extensions | e2b34efe23795f6db9c59100534a40f0813c3d95 | [
"MIT"
] | 4,061 | 2017-10-27T23:19:56.000Z | 2022-03-31T23:18:30.000Z | src/hardware-security-modules/azext_hardware_security_modules/vendored_sdks/hardwaresecuritymodules/operations/__init__.py | Mannan2812/azure-cli-extensions | e2b34efe23795f6db9c59100534a40f0813c3d95 | [
"MIT"
] | 802 | 2017-10-11T17:36:26.000Z | 2022-03-31T22:24:32.000Z | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | 41.071429 | 94 | 0.577391 |
from ._dedicated_hsm_operations import DedicatedHsmOperations
__all__ = [
'DedicatedHsmOperations',
]
| true | true |
1c1c30fcd44f66e5cf12fc2c5b39bb583b82d0aa | 1,106 | py | Python | azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/models/usage_name.py | JonathanGailliez/azure-sdk-for-python | f0f051bfd27f8ea512aea6fc0c3212ee9ee0029b | [
"MIT"
] | 1 | 2021-09-07T18:36:04.000Z | 2021-09-07T18:36:04.000Z | azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/models/usage_name.py | JonathanGailliez/azure-sdk-for-python | f0f051bfd27f8ea512aea6fc0c3212ee9ee0029b | [
"MIT"
] | 2 | 2019-10-02T23:37:38.000Z | 2020-10-02T01:17:31.000Z | azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/models/usage_name.py | JonathanGailliez/azure-sdk-for-python | f0f051bfd27f8ea512aea6fc0c3212ee9ee0029b | [
"MIT"
] | 1 | 2018-08-28T14:36:47.000Z | 2018-08-28T14:36:47.000Z | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | 33.515152 | 76 | 0.586799 |
from msrest.serialization import Model
class UsageName(Model):
_attribute_map = {
'value': {'key': 'value', 'type': 'str'},
'localized_value': {'key': 'localizedValue', 'type': 'str'},
}
def __init__(self, **kwargs):
super(UsageName, self).__init__(**kwargs)
se... | true | true |
1c1c314e6d7ee299b65023cc5e70d16d72f33bc2 | 915 | py | Python | venv/lib/python2.7/site-packages/ansible/release.py | haind27/test01 | 7f86c0a33eb0874a6c3f5ff9a923fd0cfc8ef852 | [
"MIT"
] | null | null | null | venv/lib/python2.7/site-packages/ansible/release.py | haind27/test01 | 7f86c0a33eb0874a6c3f5ff9a923fd0cfc8ef852 | [
"MIT"
] | null | null | null | venv/lib/python2.7/site-packages/ansible/release.py | haind27/test01 | 7f86c0a33eb0874a6c3f5ff9a923fd0cfc8ef852 | [
"MIT"
] | null | null | null | # (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
#
# This file is part of Ansible
#
# Ansible 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 License, or
# (at your option) an... | 36.6 | 70 | 0.760656 |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
__version__ = '2.6.2'
__author__ = 'Ansible, Inc.'
__codename__ = 'Heartbreaker'
| true | true |
1c1c32bbdc92c76a1042f8f202df2ef6af2856a0 | 5,793 | py | Python | awswrangler/catalog/_delete.py | ibanmarco/aws-data-wrangler | e99937296075c671e5f8a0998b430879c808687d | [
"Apache-2.0"
] | 1 | 2020-11-10T12:37:08.000Z | 2020-11-10T12:37:08.000Z | awswrangler/catalog/_delete.py | ibanmarco/aws-data-wrangler | e99937296075c671e5f8a0998b430879c808687d | [
"Apache-2.0"
] | null | null | null | awswrangler/catalog/_delete.py | ibanmarco/aws-data-wrangler | e99937296075c671e5f8a0998b430879c808687d | [
"Apache-2.0"
] | null | null | null | """AWS Glue Catalog Delete Module."""
import logging
from typing import List, Optional
import boto3
from awswrangler import _utils
from awswrangler._config import apply_configs
from awswrangler.catalog._get import _get_partitions
from awswrangler.catalog._utils import _catalog_id
_logger: logging.Logger = logging.g... | 31.483696 | 120 | 0.649922 |
import logging
from typing import List, Optional
import boto3
from awswrangler import _utils
from awswrangler._config import apply_configs
from awswrangler.catalog._get import _get_partitions
from awswrangler.catalog._utils import _catalog_id
_logger: logging.Logger = logging.getLogger(__name__)
@apply_configs
de... | true | true |
1c1c33116dd566633af92abfcded10bf80154984 | 42,528 | py | Python | db_transfer.py | ylc429/foc- | 0bea811a241c13020f077baeddb5806c1d37c817 | [
"Apache-2.0"
] | 2 | 2021-01-16T08:15:21.000Z | 2021-03-07T06:01:43.000Z | db_transfer.py | ylc429/foc- | 0bea811a241c13020f077baeddb5806c1d37c817 | [
"Apache-2.0"
] | 14 | 2021-01-05T06:58:04.000Z | 2022-02-04T19:06:02.000Z | db_transfer.py | liujang/foc- | 03cd4b023efa943b80c9d8e16027bda9d91444a5 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/python
# -*- coding: UTF-8 -*-
import logging
import time
import os
from server_pool import ServerPool
import traceback
from shadowsocks import common, shell
from configloader import load_config, get_config
import importloader
import platform
import fcntl
import cymysql
import socket
def g_socket_ping(tcp... | 38.45208 | 148 | 0.506796 |
import logging
import time
import os
from server_pool import ServerPool
import traceback
from shadowsocks import common, shell
from configloader import load_config, get_config
import importloader
import platform
import fcntl
import cymysql
import socket
def g_socket_ping(tcp_tuple=None, host=None, port=None):
... | true | true |
1c1c33117e3f85b6cb001900000080d82e505a7e | 1,029 | py | Python | keras/preprocessing/__init__.py | tsheaff/keras | ee227dda766d769b7499a5549e8ed77b5e88105b | [
"Apache-2.0"
] | 1 | 2020-02-02T04:43:33.000Z | 2020-02-02T04:43:33.000Z | keras/preprocessing/__init__.py | tsheaff/keras | ee227dda766d769b7499a5549e8ed77b5e88105b | [
"Apache-2.0"
] | 1 | 2022-02-03T12:41:50.000Z | 2022-02-03T12:47:45.000Z | keras/preprocessing/__init__.py | tsheaff/keras | ee227dda766d769b7499a5549e8ed77b5e88105b | [
"Apache-2.0"
] | 1 | 2020-12-13T22:14:48.000Z | 2020-12-13T22:14:48.000Z | # Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 46.772727 | 111 | 0.728863 |
from keras import backend
from keras.preprocessing import image
from keras.preprocessing import sequence
from keras.preprocessing import text
from keras.preprocessing import timeseries
from keras.utils import all_utils as utils
| true | true |
1c1c3416b824ea6f5419fa3f1209514735dd3b9c | 730 | py | Python | tests/pipelines/bar_mgmt.py | Anthonyhawkins/concourse-kit | 59c33b9d78480cc0acf32a06aac3b423621ab79f | [
"MIT"
] | null | null | null | tests/pipelines/bar_mgmt.py | Anthonyhawkins/concourse-kit | 59c33b9d78480cc0acf32a06aac3b423621ab79f | [
"MIT"
] | null | null | null | tests/pipelines/bar_mgmt.py | Anthonyhawkins/concourse-kit | 59c33b9d78480cc0acf32a06aac3b423621ab79f | [
"MIT"
] | null | null | null | from yamlmaker import env
concourse_target = "my-team"
def pipeline_config():
return {
"jobs": [
{
"name": "bar-job-" + env("ENVIRONMENT"),
"plan": [
{
"task": "foo-task",
"config": {
"platform": "linux",
... | 23.548387 | 52 | 0.29589 | from yamlmaker import env
concourse_target = "my-team"
def pipeline_config():
return {
"jobs": [
{
"name": "bar-job-" + env("ENVIRONMENT"),
"plan": [
{
"task": "foo-task",
"config": {
"platform": "linux",
... | true | true |
1c1c35e00fa65f26d922f1e5e44234b2cd9e5c9c | 15,513 | py | Python | Part1/record_violation.py | ParashRahman/Database-Project | 3a934d82289b58dcf83497b658970b2d336c1fba | [
"Apache-2.0"
] | null | null | null | Part1/record_violation.py | ParashRahman/Database-Project | 3a934d82289b58dcf83497b658970b2d336c1fba | [
"Apache-2.0"
] | null | null | null | Part1/record_violation.py | ParashRahman/Database-Project | 3a934d82289b58dcf83497b658970b2d336c1fba | [
"Apache-2.0"
] | null | null | null | from application import Application
from error_checker import ErrorChecker
from errors import InvalidDateException
import add_person
class RecordViolation(Application):
def start_application(self, c):
self.cursor = c
self.list_of_inputs = [ None for i in range(8) ]
self.get_violation_no(0... | 38.115479 | 116 | 0.475988 | from application import Application
from error_checker import ErrorChecker
from errors import InvalidDateException
import add_person
class RecordViolation(Application):
def start_application(self, c):
self.cursor = c
self.list_of_inputs = [ None for i in range(8) ]
self.get_violation_no(0... | true | true |
1c1c35f601ab94c40e0e31e972b0a96afdadf3d3 | 4,100 | py | Python | for_straight_forward_relion/jspr_refine_2_relion_nofilename_for_relion.py | homurachan/Block-based-recontruction | b3fc02a0648db6aaa5d77dcc4b8e10f3361d66f4 | [
"WTFPL"
] | 11 | 2018-04-17T01:41:11.000Z | 2020-12-11T05:43:21.000Z | for_straight_forward_relion/jspr_refine_2_relion_nofilename_for_relion.py | homurachan/Block-based-recontruction | b3fc02a0648db6aaa5d77dcc4b8e10f3361d66f4 | [
"WTFPL"
] | null | null | null | for_straight_forward_relion/jspr_refine_2_relion_nofilename_for_relion.py | homurachan/Block-based-recontruction | b3fc02a0648db6aaa5d77dcc4b8e10f3361d66f4 | [
"WTFPL"
] | 3 | 2019-08-23T07:48:50.000Z | 2020-12-08T07:31:41.000Z | #!/usr/bin/env python
import math, os, sys
try:
from optparse import OptionParser
except:
from optik import OptionParser
def main():
(lstfile, ny,output) = parse_command_line()
g = open(lstfile, "r")
lst_line = g.readlines()
r=open(output,"w")
test=str(lst_line[0].split()[0])
start=3
if(test=="#LST"):
sta... | 31.060606 | 97 | 0.640976 |
import math, os, sys
try:
from optparse import OptionParser
except:
from optik import OptionParser
def main():
(lstfile, ny,output) = parse_command_line()
g = open(lstfile, "r")
lst_line = g.readlines()
r=open(output,"w")
test=str(lst_line[0].split()[0])
start=3
if(test=="#LST"):
start=1
warning=0
for ... | false | true |
1c1c36a9cbc3d00d2521c9e572947231ce0fc8e0 | 1,729 | py | Python | setup.py | tierra-colada/cppguts | 473e1462e11a1d081e9a4dad7efb3867ba02355c | [
"MIT"
] | 1 | 2021-09-19T21:58:08.000Z | 2021-09-19T21:58:08.000Z | setup.py | tierra-colada/cppguts | 473e1462e11a1d081e9a4dad7efb3867ba02355c | [
"MIT"
] | null | null | null | setup.py | tierra-colada/cppguts | 473e1462e11a1d081e9a4dad7efb3867ba02355c | [
"MIT"
] | null | null | null | import setuptools
# read the contents of your README file
from pathlib import Path
this_directory = Path(__file__).parent
long_description = (this_directory / "README.md").read_text()
setuptools.setup(
name='cppguts',
version='1.0.2',
packages=setuptools.find_packages(),
url='https://github... | 38.422222 | 93 | 0.635049 | import setuptools
from pathlib import Path
this_directory = Path(__file__).parent
long_description = (this_directory / "README.md").read_text()
setuptools.setup(
name='cppguts',
version='1.0.2',
packages=setuptools.find_packages(),
url='https://github.com/tierra-colada/cppguts',
licens... | true | true |
1c1c36f42ab422d994654343ca2543a986729de9 | 77,675 | py | Python | pyangbind/plugin/pybind.py | sedonasys/pyangbind | e0fa0df59550711c576d769683a8490fe4ef2ebd | [
"Apache-2.0"
] | null | null | null | pyangbind/plugin/pybind.py | sedonasys/pyangbind | e0fa0df59550711c576d769683a8490fe4ef2ebd | [
"Apache-2.0"
] | null | null | null | pyangbind/plugin/pybind.py | sedonasys/pyangbind | e0fa0df59550711c576d769683a8490fe4ef2ebd | [
"Apache-2.0"
] | 1 | 2019-11-06T09:48:06.000Z | 2019-11-06T09:48:06.000Z | """
Copyright 2015, Rob Shakir (rjs@jive.com, rjs@rob.sh)
Modifications copyright 2016, Google Inc.
This project has been supported by:
* Google, Inc.
* Jive Communications, Inc.
* BT plc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except i... | 43.491041 | 119 | 0.551722 | from __future__ import unicode_literals
import copy
import decimal
import optparse
import os
import sys
from collections import OrderedDict
import six
from bitarray import bitarray
from pyang import plugin, statements, util
import pyangbind.helpers.misc as misc_help
from pyangbind.helpers.identity import IdentitySto... | true | true |
1c1c36f4984b12bbd2f10b4cca96e7d532ff6912 | 3,192 | py | Python | scripts/run-corpus.py | xingweitian/crypto-checker-1 | 5f89ea0fecc570ec133fdffb7205a151c370f5a5 | [
"BSD-3-Clause"
] | null | null | null | scripts/run-corpus.py | xingweitian/crypto-checker-1 | 5f89ea0fecc570ec133fdffb7205a151c370f5a5 | [
"BSD-3-Clause"
] | 18 | 2020-05-02T07:19:07.000Z | 2022-03-30T20:49:05.000Z | scripts/run-corpus.py | xingweitian/crypto-checker-1 | 5f89ea0fecc570ec133fdffb7205a151c370f5a5 | [
"BSD-3-Clause"
] | 3 | 2020-05-10T15:24:18.000Z | 2022-01-25T00:39:23.000Z | import argparse
import os
import shlex
import subprocess
import sys
import yaml
# python run-corpus.py --corpus-file <absPath> --executable <absPath>
def main():
parser = argparse.ArgumentParser()
parser.add_argument('--corpus-file', dest='corpus_file', required=True)
parser.add_argument('--executable'... | 34.322581 | 103 | 0.657268 | import argparse
import os
import shlex
import subprocess
import sys
import yaml
def main():
parser = argparse.ArgumentParser()
parser.add_argument('--corpus-file', dest='corpus_file', required=True)
parser.add_argument('--executable', dest='executable', required=True)
args = parser.parse_args()
... | false | true |
1c1c3735092f591df6fba4b068e40244ce65fe81 | 4,389 | py | Python | utils/dartsjson.py | lanhin/TripletRun | 06f73a6911fae2f9874bed8f9d68bf0d3fd5e973 | [
"MIT"
] | 15 | 2019-03-22T16:07:53.000Z | 2021-07-31T03:22:34.000Z | utils/dartsjson.py | lanhin/TripletRun | 06f73a6911fae2f9874bed8f9d68bf0d3fd5e973 | [
"MIT"
] | null | null | null | utils/dartsjson.py | lanhin/TripletRun | 06f73a6911fae2f9874bed8f9d68bf0d3fd5e973 | [
"MIT"
] | 2 | 2018-05-23T08:30:39.000Z | 2020-08-28T11:13:40.000Z | #/usr/bin/env python
'''
@2018-05 by lanhin
Transform DAG file of DARTS json format.
Usage: python2 dot2json.py <dotfile>
The output file name is <dotfile>.json
'''
import sys
import os
import re
if (len(sys.argv)) != 2:
print "Usage: python2 dot2json.py <dotfile>"
exit(1)
filein = sys.argv[1]
fileout = f... | 31.57554 | 144 | 0.472089 |
'''
@2018-05 by lanhin
Transform DAG file of DARTS json format.
Usage: python2 dot2json.py <dotfile>
The output file name is <dotfile>.json
'''
import sys
import os
import re
if (len(sys.argv)) != 2:
print "Usage: python2 dot2json.py <dotfile>"
exit(1)
filein = sys.argv[1]
fileout = filein + '.json'
pri... | false | true |
1c1c3865c9c0f4ce1f59d88157af36eb69d2774c | 7,289 | py | Python | utils/custom.py | sharat910/datacube-iirs | 1b7e2d192d969609756def8923c20899733e695d | [
"Apache-2.0"
] | 7 | 2016-06-29T09:11:46.000Z | 2017-08-19T09:54:09.000Z | utils/custom.py | HarshvardhanM/datacube-iirs | 1b7e2d192d969609756def8923c20899733e695d | [
"Apache-2.0"
] | null | null | null | utils/custom.py | HarshvardhanM/datacube-iirs | 1b7e2d192d969609756def8923c20899733e695d | [
"Apache-2.0"
] | 5 | 2016-07-14T17:16:05.000Z | 2021-02-13T18:30:03.000Z | # coding=utf-8
"""
Ingest data from the command-line.
"""
from __future__ import absolute_import, division
# import uuid
# import logging
# from xml.etree import ElementTree
# from pathlib import Path
# import yaml
# import click
# from osgeo import gdal, osr
# from dateutil import parser
import uuid
import logging
f... | 34.060748 | 169 | 0.592537 |
"""
Ingest data from the command-line.
"""
from __future__ import absolute_import, division
import uuid
import logging
from xml.etree import ElementTree
from pathlib import Path
import yaml
import click
from osgeo import gdal, osr
from dateutil import parser
from datetime import timedelta
import rasterio.war... | false | true |
1c1c38bfc56285c2eb8287efc9c18c5319bb4ba7 | 14,889 | py | Python | tests/test_sasl.py | sariabod/aiokafka | 9b21352f42d71d5180819182e155ab1e6086c205 | [
"Apache-2.0"
] | null | null | null | tests/test_sasl.py | sariabod/aiokafka | 9b21352f42d71d5180819182e155ab1e6086c205 | [
"Apache-2.0"
] | null | null | null | tests/test_sasl.py | sariabod/aiokafka | 9b21352f42d71d5180819182e155ab1e6086c205 | [
"Apache-2.0"
] | null | null | null | import pytest
from ._testutil import (
KafkaIntegrationTestCase, run_until_complete, kafka_versions
)
from aiokafka.producer import AIOKafkaProducer
from aiokafka.consumer import AIOKafkaConsumer
from aiokafka.errors import (
TopicAuthorizationFailedError, GroupAuthorizationFailedError,
TransactionalIdAu... | 38.472868 | 79 | 0.632749 | import pytest
from ._testutil import (
KafkaIntegrationTestCase, run_until_complete, kafka_versions
)
from aiokafka.producer import AIOKafkaProducer
from aiokafka.consumer import AIOKafkaConsumer
from aiokafka.errors import (
TopicAuthorizationFailedError, GroupAuthorizationFailedError,
TransactionalIdAu... | true | true |
1c1c39659187230b6866fb6b0defea4f15e3d62b | 674 | py | Python | profiles_api/permissions.py | gregtanym/udemy-profiles-rest-api | 914d735ea8bfa36302525bca78bc0739d5d7d21f | [
"MIT"
] | null | null | null | profiles_api/permissions.py | gregtanym/udemy-profiles-rest-api | 914d735ea8bfa36302525bca78bc0739d5d7d21f | [
"MIT"
] | null | null | null | profiles_api/permissions.py | gregtanym/udemy-profiles-rest-api | 914d735ea8bfa36302525bca78bc0739d5d7d21f | [
"MIT"
] | null | null | null | # create custom permission class
from rest_framework import permissions
class UpdateOwnProfile(permissions.BasePermission):
"""Allow user to edit their own profile"""
def has_object_permission(self, request, view, obj):
"""Check user is trying to edit their own profile"""
if request.method in ... | 42.125 | 129 | 0.719585 |
from rest_framework import permissions
class UpdateOwnProfile(permissions.BasePermission):
def has_object_permission(self, request, view, obj):
if request.method in permissions.SAFE_METHODS:
return True
return obj.id == request.user.id
| true | true |
1c1c3a784a7bd7e8d8d8ab2a20e98e5f7306163d | 5,685 | py | Python | Notebooks and Scripts/model_testing.py | tdeme/NLP-Partisanship | 4a289d1157ac1b96e5af3b38b2676f2d5c84e21b | [
"MIT"
] | null | null | null | Notebooks and Scripts/model_testing.py | tdeme/NLP-Partisanship | 4a289d1157ac1b96e5af3b38b2676f2d5c84e21b | [
"MIT"
] | null | null | null | Notebooks and Scripts/model_testing.py | tdeme/NLP-Partisanship | 4a289d1157ac1b96e5af3b38b2676f2d5c84e21b | [
"MIT"
] | null | null | null | from transformers import TFAutoModel, AutoTokenizer, AutoModelForSequenceClassification, DistilBertForSequenceClassification
from newspaper import Article
from torch import nn
'''
This script will test the model previously trained, and compare
its performance with that of a similar existing model that was
found on th... | 38.412162 | 133 | 0.697625 | from transformers import TFAutoModel, AutoTokenizer, AutoModelForSequenceClassification, DistilBertForSequenceClassification
from newspaper import Article
from torch import nn
def prepare_text(article_url, split=True):
article = Article(article_url)
article.download()
article.parse()
paras = article.... | true | true |
1c1c3ab918a99e66d0b45cc17877392a09bb0db6 | 295,940 | py | Python | tests/admin_views/tests.py | kartikkshirsagar/django | 368b8d20aaa16f0ef763759a0a87d986ef460584 | [
"CNRI-Python-GPL-Compatible",
"BSD-3-Clause"
] | null | null | null | tests/admin_views/tests.py | kartikkshirsagar/django | 368b8d20aaa16f0ef763759a0a87d986ef460584 | [
"CNRI-Python-GPL-Compatible",
"BSD-3-Clause"
] | null | null | null | tests/admin_views/tests.py | kartikkshirsagar/django | 368b8d20aaa16f0ef763759a0a87d986ef460584 | [
"CNRI-Python-GPL-Compatible",
"BSD-3-Clause"
] | null | null | null | import datetime
import os
import re
import unittest
from unittest import mock
from urllib.parse import parse_qsl, urljoin, urlparse
import pytz
from django.contrib.admin import AdminSite, ModelAdmin
from django.contrib.admin.helpers import ACTION_CHECKBOX_NAME
from django.contrib.admin.models import ADDITION, DELETIO... | 47.064249 | 119 | 0.651308 | import datetime
import os
import re
import unittest
from unittest import mock
from urllib.parse import parse_qsl, urljoin, urlparse
import pytz
from django.contrib.admin import AdminSite, ModelAdmin
from django.contrib.admin.helpers import ACTION_CHECKBOX_NAME
from django.contrib.admin.models import ADDITION, DELETIO... | true | true |
1c1c3c1d082f8dfe0a20683998f01ced8f5e779d | 1,145 | py | Python | models/users.py | dclavijo45/backend-whatsup | f32aa1f18489c063b5cfd9f59be9a9503f94d9ab | [
"MIT"
] | 2 | 2022-02-07T16:55:02.000Z | 2022-02-16T01:36:39.000Z | models/users.py | dclavijo45/backend-whatsup | f32aa1f18489c063b5cfd9f59be9a9503f94d9ab | [
"MIT"
] | null | null | null | models/users.py | dclavijo45/backend-whatsup | f32aa1f18489c063b5cfd9f59be9a9503f94d9ab | [
"MIT"
] | null | null | null | from sqlalchemy.sql import func
from utils.db import db
class User(db.Model):
id = db.Column(db.Integer, primary_key = True, nullable = False)
name = db.Column(db.String(60), nullable = False)
number = db.Column(db.String(15), unique=True, nullable = False)
birthday = db.Column(db.Date, nullable = Fals... | 44.038462 | 121 | 0.678603 | from sqlalchemy.sql import func
from utils.db import db
class User(db.Model):
id = db.Column(db.Integer, primary_key = True, nullable = False)
name = db.Column(db.String(60), nullable = False)
number = db.Column(db.String(15), unique=True, nullable = False)
birthday = db.Column(db.Date, nullable = Fals... | true | true |
1c1c3c9de72cd724e62eddc1de692ff6529277cf | 1,279 | py | Python | app/streamflow/sherlock/sh_Q90ref_HUC.py | fkwai/geolearn | 30cb4353d22af5020a48100d07ab04f465a315b0 | [
"MIT"
] | null | null | null | app/streamflow/sherlock/sh_Q90ref_HUC.py | fkwai/geolearn | 30cb4353d22af5020a48100d07ab04f465a315b0 | [
"MIT"
] | null | null | null | app/streamflow/sherlock/sh_Q90ref_HUC.py | fkwai/geolearn | 30cb4353d22af5020a48100d07ab04f465a315b0 | [
"MIT"
] | 2 | 2021-04-04T02:45:59.000Z | 2022-03-19T09:41:39.000Z | from hydroDL import kPath
from hydroDL.data import usgs, gageII, gridMET, ntn
from hydroDL.master import slurm
from hydroDL.master import basinFull
varX = gridMET.varLst
varY = ['runoff']
varXC = gageII.lstWaterQuality
varYC = None
sd = '1979-01-01'
ed = '2010-01-01'
dataName = 'Q90ref'
globalName = '{}-B10'.format(d... | 34.567568 | 90 | 0.64269 | from hydroDL import kPath
from hydroDL.data import usgs, gageII, gridMET, ntn
from hydroDL.master import slurm
from hydroDL.master import basinFull
varX = gridMET.varLst
varY = ['runoff']
varXC = gageII.lstWaterQuality
varYC = None
sd = '1979-01-01'
ed = '2010-01-01'
dataName = 'Q90ref'
globalName = '{}-B10'.format(d... | true | true |
1c1c3d18dcbd0b4a9074e91a0ba34c992af2ed3a | 12,283 | py | Python | pysnmp/CISCO-CLUSTER-MIB.py | agustinhenze/mibs.snmplabs.com | 1fc5c07860542b89212f4c8ab807057d9a9206c7 | [
"Apache-2.0"
] | 11 | 2021-02-02T16:27:16.000Z | 2021-08-31T06:22:49.000Z | pysnmp/CISCO-CLUSTER-MIB.py | agustinhenze/mibs.snmplabs.com | 1fc5c07860542b89212f4c8ab807057d9a9206c7 | [
"Apache-2.0"
] | 75 | 2021-02-24T17:30:31.000Z | 2021-12-08T00:01:18.000Z | pysnmp/CISCO-CLUSTER-MIB.py | agustinhenze/mibs.snmplabs.com | 1fc5c07860542b89212f4c8ab807057d9a9206c7 | [
"Apache-2.0"
] | 10 | 2019-04-30T05:51:36.000Z | 2022-02-16T03:33:41.000Z | #
# PySNMP MIB module CISCO-CLUSTER-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-CLUSTER-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:36:13 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Ma... | 126.628866 | 1,894 | 0.764308 |
Integer, OctetString, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "Integer", "OctetString", "ObjectIdentifier")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
SingleValueConstraint, ConstraintsIntersection, ValueSizeConstraint, ValueRangeConstraint, ConstraintsUnion = mibBuild... | true | true |
1c1c3dbe64eff57e5859ef704036430ae78d6d63 | 4,362 | py | Python | qtp_biom/tests/test_plugin.py | antgonza/qtp-biom | 731b5529fc5f559a868c1d3a6e14cecf4e59198b | [
"BSD-3-Clause"
] | 2 | 2017-01-15T07:16:47.000Z | 2021-05-25T21:51:06.000Z | qtp_biom/tests/test_plugin.py | antgonza/qtp-biom | 731b5529fc5f559a868c1d3a6e14cecf4e59198b | [
"BSD-3-Clause"
] | 11 | 2016-06-15T20:17:13.000Z | 2020-11-10T22:10:48.000Z | qtp_biom/tests/test_plugin.py | antgonza/qtp-biom | 731b5529fc5f559a868c1d3a6e14cecf4e59198b | [
"BSD-3-Clause"
] | 3 | 2016-06-15T18:34:56.000Z | 2018-01-25T02:37:26.000Z | # -----------------------------------------------------------------------------
# Copyright (c) 2014--, The Qiita Development Team.
#
# Distributed under the terms of the BSD 3-clause License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------------... | 35.177419 | 79 | 0.520174 |
from unittest import main
from tempfile import mkdtemp, mkstemp
from os import remove, close
from os.path import exists, isdir
from shutil import rmtree
from json import dumps
from time import sleep
import numpy as np
from biom import Table
from biom.util import biom_open
from qiita_client.testing import Plugi... | true | true |
1c1c3dbf35b38f098e975305a78627e932320dbf | 623 | py | Python | scripts/submit-clean.py | pauliacomi/paper-latex-template | 65397472aa8351d2bd556d8afbb118c6145a234c | [
"MIT"
] | 2 | 2021-08-15T07:00:12.000Z | 2021-11-02T07:24:04.000Z | scripts/submit-clean.py | pauliacomi/paper-latex-template | 65397472aa8351d2bd556d8afbb118c6145a234c | [
"MIT"
] | null | null | null | scripts/submit-clean.py | pauliacomi/paper-latex-template | 65397472aa8351d2bd556d8afbb118c6145a234c | [
"MIT"
] | 3 | 2021-06-12T08:16:51.000Z | 2021-07-17T14:35:41.000Z | """Clean processed folder.
Usage: clean [--output_dir=<output_dir>] [<directory>]
"""
import argparse
import pathlib
import shutil
import os
def main(source_dir):
if source_dir.exists():
shutil.rmtree(source_dir)
zip_path = source_dir.parent / "manuscript.zip"
if zip_path.exists():
os.re... | 21.482759 | 75 | 0.666132 |
import argparse
import pathlib
import shutil
import os
def main(source_dir):
if source_dir.exists():
shutil.rmtree(source_dir)
zip_path = source_dir.parent / "manuscript.zip"
if zip_path.exists():
os.remove(zip_path)
if __name__ == "__main__":
parser = argparse.ArgumentParser(descri... | true | true |
1c1c3dbf49f981776138f197fa961ec25da6d7c7 | 13,153 | py | Python | nmtpy/models/mnmt_decinit.py | lium-lst/nmtpy | dc0a1618f217d5117d6abeacdc15a22443561acf | [
"MIT"
] | 144 | 2016-07-29T06:02:49.000Z | 2020-12-04T08:58:20.000Z | nmtpy/models/mnmt_decinit.py | lium-lst/nmtpy | dc0a1618f217d5117d6abeacdc15a22443561acf | [
"MIT"
] | 21 | 2017-02-16T15:49:20.000Z | 2018-03-15T18:11:08.000Z | nmtpy/models/mnmt_decinit.py | lium-lst/nmtpy | dc0a1618f217d5117d6abeacdc15a22443561acf | [
"MIT"
] | 39 | 2017-02-07T16:40:08.000Z | 2021-08-09T17:19:12.000Z | # -*- coding: utf-8 -*-
from collections import OrderedDict
import theano
import theano.tensor as T
# Ours
from ..layers import dropout, tanh, get_new_layer
from ..defaults import INT, FLOAT
from ..nmtutils import norm_weight
from ..iterators.mnmt import MNMTIterator
from .attention import Model as Attention
######... | 45.670139 | 175 | 0.579259 |
from collections import OrderedDict
import theano
import theano.tensor as T
from ..layers import dropout, tanh, get_new_layer
from ..defaults import INT, FLOAT
from ..nmtutils import norm_weight
from ..iterators.mnmt import MNMTIterator
from .attention import Model as Attention
ale=self.weight_init, layernorm=Fal... | true | true |
1c1c3ddbfce85320576d6622ff0a4fa6d8b630ff | 6,521 | gyp | Python | chromium/ui/views/examples/examples.gyp | wedataintelligence/vivaldi-source | 22a46f2c969f6a0b7ca239a05575d1ea2738768c | [
"BSD-3-Clause"
] | null | null | null | chromium/ui/views/examples/examples.gyp | wedataintelligence/vivaldi-source | 22a46f2c969f6a0b7ca239a05575d1ea2738768c | [
"BSD-3-Clause"
] | null | null | null | chromium/ui/views/examples/examples.gyp | wedataintelligence/vivaldi-source | 22a46f2c969f6a0b7ca239a05575d1ea2738768c | [
"BSD-3-Clause"
] | null | null | null | # Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'variables': {
'chromium_code': 1,
},
'targets': [
{
# GN version: //ui/views/examples
'target_name': 'views_examples_lib',
... | 31.809756 | 85 | 0.5332 |
{
'variables': {
'chromium_code': 1,
},
'targets': [
{
'target_name': 'views_examples_lib',
'type': '<(component)',
'dependencies': [
'../../../base/base.gyp:base',
'../../../skia/skia.gyp:skia',
'../../../third_party/icu/icu.gyp:icui18n',
'../..... | true | true |
1c1c3edb9629318e17d6857aa274b3290b4c8d61 | 16 | py | Python | 10. Old Project/Projects/Sampling/wiseml/__init__.py | Collapse24/Work-projects | 9b84273a88eb529fd7dcca1a103b938972a36c2b | [
"MIT"
] | null | null | null | 10. Old Project/Projects/Sampling/wiseml/__init__.py | Collapse24/Work-projects | 9b84273a88eb529fd7dcca1a103b938972a36c2b | [
"MIT"
] | null | null | null | 10. Old Project/Projects/Sampling/wiseml/__init__.py | Collapse24/Work-projects | 9b84273a88eb529fd7dcca1a103b938972a36c2b | [
"MIT"
] | null | null | null | name = 'wiseml'
| 8 | 15 | 0.625 | name = 'wiseml'
| true | true |
1c1c3f230e55807f811ae9eea82ca9ff51abae60 | 32,839 | py | Python | unit_tests/test_nova_cc_contexts.py | aieri/charm-nova-cloud-controller | dde75693c71fd23ae85b8d3f1ae2dfa685df3170 | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | unit_tests/test_nova_cc_contexts.py | aieri/charm-nova-cloud-controller | dde75693c71fd23ae85b8d3f1ae2dfa685df3170 | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | unit_tests/test_nova_cc_contexts.py | aieri/charm-nova-cloud-controller | dde75693c71fd23ae85b8d3f1ae2dfa685df3170 | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | # Copyright 2016 Canonical 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 writing, s... | 47.318444 | 79 | 0.617954 |
import json
import mock
import hooks.nova_cc_context as context
from charmhelpers.contrib.openstack import neutron
from charmhelpers.contrib.openstack import utils
from unit_tests.test_utils import CharmTestCase
TO_PATCH = [
'charmhelpers.contrib.hahelpers.cluster.https',
'charmhelpers.contrib.... | true | true |
1c1c4077a98e1e1adfb4d53e567a823981a490e1 | 90 | py | Python | zunda/__init__.py | ikegami-yukino/zunda-python | d6d293d7f0c3f8a3e25f243fcd9b87d08423f425 | [
"MIT"
] | 10 | 2019-02-23T16:52:50.000Z | 2021-12-05T07:08:34.000Z | zunda/__init__.py | ikegami-yukino/zunda-python | d6d293d7f0c3f8a3e25f243fcd9b87d08423f425 | [
"MIT"
] | 3 | 2019-11-27T10:53:02.000Z | 2019-12-09T07:49:08.000Z | zunda/__init__.py | ikegami-yukino/zunda-python | d6d293d7f0c3f8a3e25f243fcd9b87d08423f425 | [
"MIT"
] | 1 | 2019-11-27T10:51:57.000Z | 2019-11-27T10:51:57.000Z | from .zunda import Parser
VERSION = (0, 1, 3)
__version__ = "0.1.3"
__all__ = ["Parser"]
| 15 | 25 | 0.644444 | from .zunda import Parser
VERSION = (0, 1, 3)
__version__ = "0.1.3"
__all__ = ["Parser"]
| true | true |
1c1c409ed5d6630c66ccb60413cebb298360c626 | 166 | bzl | Python | bazel/emscripten_toolchain/wasm_rules.bzl | lewing/emsdk | db872c7baedcaf94c6cbcc0270eaf663dee747df | [
"MIT"
] | 5 | 2020-11-22T17:29:08.000Z | 2021-05-28T23:05:33.000Z | bazel/emscripten_toolchain/wasm_rules.bzl | lewing/emsdk | db872c7baedcaf94c6cbcc0270eaf663dee747df | [
"MIT"
] | null | null | null | bazel/emscripten_toolchain/wasm_rules.bzl | lewing/emsdk | db872c7baedcaf94c6cbcc0270eaf663dee747df | [
"MIT"
] | 2 | 2021-03-23T08:30:46.000Z | 2021-03-24T09:45:41.000Z | """Rules related to C++ and WebAssembly.
"""
load("//emscripten_toolchain:wasm_cc_binary.bzl", _wasm_cc_binary = "wasm_cc_binary")
wasm_cc_binary = _wasm_cc_binary
| 23.714286 | 85 | 0.771084 |
load("//emscripten_toolchain:wasm_cc_binary.bzl", _wasm_cc_binary = "wasm_cc_binary")
wasm_cc_binary = _wasm_cc_binary
| true | true |
1c1c40a156ff09b4f3775134367af495862bb94c | 71,398 | py | Python | selfdrive/car/toyota/values.py | hankteng19650323/dragonpilot | 35f5828690d0e98eb605661354b50d59a8b190ba | [
"MIT"
] | 1 | 2019-09-19T12:23:26.000Z | 2019-09-19T12:23:26.000Z | selfdrive/car/toyota/values.py | hankteng19650323/dragonpilot | 35f5828690d0e98eb605661354b50d59a8b190ba | [
"MIT"
] | null | null | null | selfdrive/car/toyota/values.py | hankteng19650323/dragonpilot | 35f5828690d0e98eb605661354b50d59a8b190ba | [
"MIT"
] | null | null | null | # flake8: noqa
from cereal import car
from selfdrive.car import dbc_dict
from selfdrive.config import Conversions as CV
Ecu = car.CarParams.Ecu
MIN_ACC_SPEED = 19. * CV.MPH_TO_MS
PEDAL_TRANSITION = 10. * CV.MPH_TO_MS
class CarControllerParams:
ACCEL_MAX = 1.5 # m/s2, lower than allowed 2.0 m/s2 for tuning reason... | 42.574836 | 247 | 0.651867 |
from cereal import car
from selfdrive.car import dbc_dict
from selfdrive.config import Conversions as CV
Ecu = car.CarParams.Ecu
MIN_ACC_SPEED = 19. * CV.MPH_TO_MS
PEDAL_TRANSITION = 10. * CV.MPH_TO_MS
class CarControllerParams:
ACCEL_MAX = 1.5
ACCEL_MIN = -3.5
STEER_MAX = 1500
STEER_DELTA_UP = 10 ... | true | true |
1c1c4184cff30cbd28285c087c9071248be98f0c | 5,436 | py | Python | returns_policy.py | GavinAbercrombie/motion_policy_detection | f7a609f8af8acbe781418edbfec7629b4225b3c0 | [
"MIT"
] | null | null | null | returns_policy.py | GavinAbercrombie/motion_policy_detection | f7a609f8af8acbe781418edbfec7629b4225b3c0 | [
"MIT"
] | null | null | null | returns_policy.py | GavinAbercrombie/motion_policy_detection | f7a609f8af8acbe781418edbfec7629b4225b3c0 | [
"MIT"
] | null | null | null | ### Matches Hansard HoC debate motions and motion quasi-sentences
### to policy codes from the Comparative Manifesto Project.
import os, csv
from collections import Counter, OrderedDict
from nltk import word_tokenize
from nltk.stem import WordNetLemmatizer
from sklearn.feature_extraction.text import TfidfVe... | 37.489655 | 122 | 0.65986 | ine_similarity
import heapq
print('Matching motions to policies ...\n')
def lemmatizer(text):
lemmad = ''
wnl = WordNetLemmatizer()
lemma_list = [wnl.lemmatize(t) for t in word_tokenize(text)]
for lem in lemma_list:
lemmad = lemmad + lem + ' '
return lemmad
tfidf_vectorizer = TfidfVecto... | true | true |
1c1c435fa1e91f1cfc12b32c1d8681de9e250b51 | 14,206 | py | Python | django/db/backends/oracle/creation.py | arachnegl/django | c4e796aa1bab70ee66151d24a061af811e08ad08 | [
"BSD-3-Clause"
] | 1 | 2019-01-14T10:58:43.000Z | 2019-01-14T10:58:43.000Z | django/db/backends/oracle/creation.py | arachnegl/django | c4e796aa1bab70ee66151d24a061af811e08ad08 | [
"BSD-3-Clause"
] | null | null | null | django/db/backends/oracle/creation.py | arachnegl/django | c4e796aa1bab70ee66151d24a061af811e08ad08 | [
"BSD-3-Clause"
] | null | null | null | import sys
import time
from django.conf import settings
from django.db.backends.creation import BaseDatabaseCreation
from django.db.utils import DatabaseError
from django.utils.six.moves import input
TEST_DATABASE_PREFIX = 'test_'
PASSWORD = 'Im_a_lumberjack'
class DatabaseCreation(BaseDatabaseCreation):
def ... | 46.273616 | 107 | 0.583767 | import sys
import time
from django.conf import settings
from django.db.backends.creation import BaseDatabaseCreation
from django.db.utils import DatabaseError
from django.utils.six.moves import input
TEST_DATABASE_PREFIX = 'test_'
PASSWORD = 'Im_a_lumberjack'
class DatabaseCreation(BaseDatabaseCreation):
def ... | true | true |
1c1c43926df7273316879c96d123c139aea5ef2b | 150 | py | Python | session_wordcount/pro/wordcount/apps.py | olzlgur/Like_lion | ac55cd5a0dd81863cb9481b1c7635d629d409660 | [
"MIT"
] | null | null | null | session_wordcount/pro/wordcount/apps.py | olzlgur/Like_lion | ac55cd5a0dd81863cb9481b1c7635d629d409660 | [
"MIT"
] | null | null | null | session_wordcount/pro/wordcount/apps.py | olzlgur/Like_lion | ac55cd5a0dd81863cb9481b1c7635d629d409660 | [
"MIT"
] | null | null | null | from django.apps import AppConfig
class WordcountConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'wordcount'
| 21.428571 | 56 | 0.766667 | from django.apps import AppConfig
class WordcountConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'wordcount'
| true | true |
1c1c442a4e31611d32e237d49797b210556ae3d4 | 6,296 | py | Python | benchmarks/f3_wrong_hints/scaling_nonlinear_software/5-19_14.py | EnricoMagnago/F3 | c863215c318d7d5f258eb9be38c6962cf6863b52 | [
"MIT"
] | 3 | 2021-04-23T23:29:26.000Z | 2022-03-23T10:00:30.000Z | benchmarks/f3_wrong_hints/scaling_nonlinear_software/5-19_14.py | EnricoMagnago/F3 | c863215c318d7d5f258eb9be38c6962cf6863b52 | [
"MIT"
] | null | null | null | benchmarks/f3_wrong_hints/scaling_nonlinear_software/5-19_14.py | EnricoMagnago/F3 | c863215c318d7d5f258eb9be38c6962cf6863b52 | [
"MIT"
] | 1 | 2021-11-17T22:02:56.000Z | 2021-11-17T22:02:56.000Z | from typing import FrozenSet, Tuple
import pysmt.typing as types
from pysmt.environment import Environment as PysmtEnv
from pysmt.fnode import FNode
from utils import symb_to_next
from hint import Hint, Location
def transition_system(env: PysmtEnv) -> Tuple[FrozenSet[FNode], FNode, FNode,
... | 34.217391 | 81 | 0.510483 | from typing import FrozenSet, Tuple
import pysmt.typing as types
from pysmt.environment import Environment as PysmtEnv
from pysmt.fnode import FNode
from utils import symb_to_next
from hint import Hint, Location
def transition_system(env: PysmtEnv) -> Tuple[FrozenSet[FNode], FNode, FNode,
... | true | true |
1c1c44c2049c16f82a61c26951f5e5c1fd2bb5d7 | 461 | py | Python | {{cookiecutter.project_slug}}/config/urls.py | Nomadicode/django-cookie | 63bce1225d481d5cd6c6f2b1e1bbb6d47a3c5dab | [
"BSD-3-Clause"
] | 3 | 2020-10-10T20:08:08.000Z | 2021-03-26T05:46:25.000Z | {{cookiecutter.project_slug}}/config/urls.py | yunior22/django-cookie | a879f8f0388ad4e7bf4950f73f7423652b3d71c6 | [
"BSD-3-Clause"
] | null | null | null | {{cookiecutter.project_slug}}/config/urls.py | yunior22/django-cookie | a879f8f0388ad4e7bf4950f73f7423652b3d71c6 | [
"BSD-3-Clause"
] | 1 | 2021-11-19T21:25:45.000Z | 2021-11-19T21:25:45.000Z | from django.conf import settings
from django.conf.urls.static import static
from django.contrib import admin
from django.urls import include, path
urlpatterns = [
# Django Admin
path('admin', admin.site.urls),
# API urls: Make changes to backend in api.py
path('api', include('urls.api')),
# Web u... | 28.8125 | 65 | 0.713666 | from django.conf import settings
from django.conf.urls.static import static
from django.contrib import admin
from django.urls import include, path
urlpatterns = [
path('admin', admin.site.urls),
path('api', include('urls.api')),
path('', include('urls.web')),
] + static(settings.MEDIA_URL,... | true | true |
1c1c44f64a3f46a5aae32ebb2c6a144e8c02122b | 4,058 | py | Python | gluoncv/utils/metrics/heatmap_accuracy.py | Kh4L/gluon-cv | 849411ed56632cd854850b07142087d599f97dcb | [
"Apache-2.0"
] | 5,447 | 2018-04-25T18:02:51.000Z | 2022-03-31T00:59:49.000Z | gluoncv/utils/metrics/heatmap_accuracy.py | Kh4L/gluon-cv | 849411ed56632cd854850b07142087d599f97dcb | [
"Apache-2.0"
] | 1,566 | 2018-04-25T21:14:04.000Z | 2022-03-31T06:42:42.000Z | gluoncv/utils/metrics/heatmap_accuracy.py | Kh4L/gluon-cv | 849411ed56632cd854850b07142087d599f97dcb | [
"Apache-2.0"
] | 1,345 | 2018-04-25T18:44:13.000Z | 2022-03-30T19:32:53.000Z | """Accuracy metric for heatmap prediction."""
# pylint: disable=assignment-from-no-return
import numpy as np
try:
from mxnet.metric import EvalMetric, check_label_shapes
except ImportError:
from mxnet.gluon.metric import EvalMetric, check_label_shapes
class HeatmapAccuracy(EvalMetric):
"""Computes heatmap... | 36.558559 | 95 | 0.573682 |
import numpy as np
try:
from mxnet.metric import EvalMetric, check_label_shapes
except ImportError:
from mxnet.gluon.metric import EvalMetric, check_label_shapes
class HeatmapAccuracy(EvalMetric):
def __init__(self, axis=1, name='heatmap_accuracy', hm_type='gaussian', threshold=0.5,
outp... | true | true |
1c1c4586e140b8eaba24b247211dfb5201438e2e | 5,043 | py | Python | tests/test_df_rows.py | Pcosmin/Optimus | ef3306d1b752bbfb1959ddb9103786acb8e9b9ba | [
"Apache-2.0"
] | 1 | 2020-09-22T13:04:37.000Z | 2020-09-22T13:04:37.000Z | tests/test_df_rows.py | rafaelang/Optimus | 809088f41588c968b2e30210f98a494a497b07ff | [
"Apache-2.0"
] | null | null | null | tests/test_df_rows.py | rafaelang/Optimus | 809088f41588c968b2e30210f98a494a497b07ff | [
"Apache-2.0"
] | null | null | null | from pyspark.sql.types import *
import optimus.helpers.functions_spark
from optimus import Optimus
from optimus.helpers.json import json_enconding
from optimus.helpers.functions import deep_sort
import unittest
from pyspark.ml.linalg import Vectors, VectorUDT, DenseVector
import numpy as np
nan = np.nan
from optimus.a... | 86.948276 | 491 | 0.639302 | from pyspark.sql.types import *
import optimus.helpers.functions_spark
from optimus import Optimus
from optimus.helpers.json import json_enconding
from optimus.helpers.functions import deep_sort
import unittest
from pyspark.ml.linalg import Vectors, VectorUDT, DenseVector
import numpy as np
nan = np.nan
from optimus.a... | true | true |
1c1c46452e5138cffde6ac3419a7605d43c9cdd5 | 5,514 | py | Python | outside_videos/fourier_series.py | saudzahirr/videos | 538a5f62f3f7c973e06763ef9da9bb8ec3f5006c | [
"MIT"
] | 3 | 2021-12-22T16:36:05.000Z | 2022-03-22T06:44:42.000Z | outside_videos/fourier_series.py | saudzahirr/videos | 538a5f62f3f7c973e06763ef9da9bb8ec3f5006c | [
"MIT"
] | 2 | 2022-01-25T17:15:02.000Z | 2022-02-05T06:02:54.000Z | outside_videos/fourier_series.py | saudzahirr/videos | 538a5f62f3f7c973e06763ef9da9bb8ec3f5006c | [
"MIT"
] | null | null | null | from manimce import *
from custom.functions import fourier_series
def square_wave(x, n):
y = 0
for i in range(1, n):
y += sin((2*i - 1)*x)/(2*i - 1)
return y
def discrete_function(x, y):
f = []
for m, n in zip(x, y):
q = [m, n, 0]
f.append(q)
print(f)
return... | 23.973913 | 130 | 0.468081 | from manimce import *
from custom.functions import fourier_series
def square_wave(x, n):
y = 0
for i in range(1, n):
y += sin((2*i - 1)*x)/(2*i - 1)
return y
def discrete_function(x, y):
f = []
for m, n in zip(x, y):
q = [m, n, 0]
f.append(q)
print(f)
return... | true | true |
1c1c46c7730adbeeb5ce1130b95db8fd6b9aca52 | 112 | py | Python | boa3_test/test_sc/bytes_test/StripBytesMethodDefault.py | CityOfZion/neo3-boa | c31fadce597abd5e0bdea76985e35c7004ab9d39 | [
"Apache-2.0"
] | 25 | 2020-07-22T19:37:43.000Z | 2022-03-08T03:23:55.000Z | boa3_test/test_sc/bytes_test/StripBytesMethodDefault.py | CityOfZion/neo3-boa | c31fadce597abd5e0bdea76985e35c7004ab9d39 | [
"Apache-2.0"
] | 419 | 2020-04-23T17:48:14.000Z | 2022-03-31T13:17:45.000Z | boa3_test/test_sc/bytes_test/StripBytesMethodDefault.py | CityOfZion/neo3-boa | c31fadce597abd5e0bdea76985e35c7004ab9d39 | [
"Apache-2.0"
] | 15 | 2020-05-21T21:54:24.000Z | 2021-11-18T06:17:24.000Z | from boa3.builtin import public
@public
def main(bytes_value: bytes) -> bytes:
return bytes_value.strip()
| 16 | 38 | 0.741071 | from boa3.builtin import public
@public
def main(bytes_value: bytes) -> bytes:
return bytes_value.strip()
| true | true |
1c1c472d16c681915ef657b57ec1220502921754 | 9,094 | py | Python | StatePerception/KerasLayer.py | graebe/StatePerception | bba6743ef95ba5f1d693ba9d409188e37b0d95ec | [
"BSD-3-Clause"
] | null | null | null | StatePerception/KerasLayer.py | graebe/StatePerception | bba6743ef95ba5f1d693ba9d409188e37b0d95ec | [
"BSD-3-Clause"
] | null | null | null | StatePerception/KerasLayer.py | graebe/StatePerception | bba6743ef95ba5f1d693ba9d409188e37b0d95ec | [
"BSD-3-Clause"
] | null | null | null | """
@author: Torben Gräber
"""
import tensorflow as tf
from keras.engine.topology import Layer
from keras.losses import mean_squared_error
from keras import backend as K
import numpy as np
# =============================================================================
# Custom Loss
# =====================... | 32.830325 | 80 | 0.533759 |
import tensorflow as tf
from keras.engine.topology import Layer
from keras.losses import mean_squared_error
from keras import backend as K
import numpy as np
class loss_with_convergence_time():
def __init__(self, loss_function=mean_squared_error, convergence_time=100):
self.loss_function... | true | true |
1c1c4a128bd968fc3be52f41e3c7afaeebf24bd1 | 566 | py | Python | Lib/lib2to3/fixes/fix_buffer.py | ystk/debian-python2.6 | 17d77164dc5d5748e54aeaa5adc89ac511fc71ae | [
"PSF-2.0"
] | 8 | 2021-11-26T06:19:06.000Z | 2022-01-11T01:30:11.000Z | Lib/lib2to3/fixes/fix_buffer.py | ystk/debian-python2.6 | 17d77164dc5d5748e54aeaa5adc89ac511fc71ae | [
"PSF-2.0"
] | 1 | 2020-09-07T15:33:56.000Z | 2020-09-07T15:33:56.000Z | Lib/lib2to3/fixes/fix_buffer.py | ystk/debian-python2.6 | 17d77164dc5d5748e54aeaa5adc89ac511fc71ae | [
"PSF-2.0"
] | 3 | 2017-04-07T12:02:22.000Z | 2020-03-23T12:11:55.000Z | # Copyright 2007 Google, Inc. All Rights Reserved.
# Licensed to PSF under a Contributor Agreement.
"""Fixer that changes buffer(...) into memoryview(...)."""
# Local imports
from .. import fixer_base
from ..fixer_util import Name
class FixBuffer(fixer_base.BaseFix):
explicit = True # The user must ask for thi... | 25.727273 | 66 | 0.632509 |
from .. import fixer_base
from ..fixer_util import Name
class FixBuffer(fixer_base.BaseFix):
explicit = True
PATTERN = """
power< name='buffer' trailer< '(' [any] ')' > any* >
"""
def transform(self, node, results):
name = results["name"]
name.replace(N... | true | true |
1c1c4bbfaa43de509439ef7267b77ac8139c557c | 54,807 | py | Python | venv/Lib/site-packages/sqlalchemy/engine/result.py | OliviaNabbosa89/Disaster_Responses | 1e66d77c303cec685dfc2ca94f4fca4cc9400570 | [
"MIT"
] | null | null | null | venv/Lib/site-packages/sqlalchemy/engine/result.py | OliviaNabbosa89/Disaster_Responses | 1e66d77c303cec685dfc2ca94f4fca4cc9400570 | [
"MIT"
] | null | null | null | venv/Lib/site-packages/sqlalchemy/engine/result.py | OliviaNabbosa89/Disaster_Responses | 1e66d77c303cec685dfc2ca94f4fca4cc9400570 | [
"MIT"
] | null | null | null | # engine/result.py
# Copyright (C) 2005-2021 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""Define generic result set constructs."""
import functools
import it... | 31.90163 | 83 | 0.583082 |
import functools
import itertools
import operator
from .row import _baserow_usecext
from .row import Row
from .. import exc
from .. import util
from ..sql.base import _generative
from ..sql.base import HasMemoized
from ..sql.base import InPlaceGenerative
from ..util import collections_abc
from ... | true | true |
1c1c4c4fdf240e7c41e7e8ce529a66ff505a1996 | 504 | py | Python | rainbow/rainbow.py | corentinmusard/ctf_fcsc_2020_writeups | c62e8905a1025a52fd27c403d37e71b17ee3f95d | [
"MIT"
] | 2 | 2020-05-04T17:08:35.000Z | 2020-05-05T07:47:18.000Z | rainbow/rainbow.py | corentinmusard/ctf_fcsc_2020_writeups | c62e8905a1025a52fd27c403d37e71b17ee3f95d | [
"MIT"
] | null | null | null | rainbow/rainbow.py | corentinmusard/ctf_fcsc_2020_writeups | c62e8905a1025a52fd27c403d37e71b17ee3f95d | [
"MIT"
] | null | null | null | #!/usr/bin/env python3.8
"""
Programme pour tester facilement les payload
"""
from base64 import b64encode
import sys
import urllib.request
def request(arg: str) -> int:
url_base = 'http://challenges2.france-cybersecurity-challenge.fr:5007/?search='
url = url_base + b64encode(arg.encode()).decode()
respons... | 25.2 | 83 | 0.686508 |
from base64 import b64encode
import sys
import urllib.request
def request(arg: str) -> int:
url_base = 'http://challenges2.france-cybersecurity-challenge.fr:5007/?search='
url = url_base + b64encode(arg.encode()).decode()
response = urllib.request.urlopen(url)
html = response.read().decode()
print... | true | true |
1c1c4c916731e97f83bdbd0cc73bbfac247c6a55 | 7,414 | py | Python | experiments/tissue_generation/forearm.py | CAMI-DKFZ/simpa_paper_experiments | f5a37d57692b29b78b85d60a38e4dc0aaa5aadfc | [
"MIT"
] | null | null | null | experiments/tissue_generation/forearm.py | CAMI-DKFZ/simpa_paper_experiments | f5a37d57692b29b78b85d60a38e4dc0aaa5aadfc | [
"MIT"
] | null | null | null | experiments/tissue_generation/forearm.py | CAMI-DKFZ/simpa_paper_experiments | f5a37d57692b29b78b85d60a38e4dc0aaa5aadfc | [
"MIT"
] | null | null | null | # SPDX-FileCopyrightText: 2021 Computer Assisted Medical Interventions Group, DKFZ
# SPDX-FileCopyrightText: 2021 Janek Groehl
# SPDX-License-Identifier: MIT
from simpa import Tags
import simpa as sp
import numpy as np
import matplotlib.pyplot as plt
from simpa.utils.libraries.structure_library import define_horizonta... | 55.744361 | 129 | 0.617346 |
from simpa import Tags
import simpa as sp
import numpy as np
import matplotlib.pyplot as plt
from simpa.utils.libraries.structure_library import define_horizontal_layer_structure_settings, \
define_vessel_structure_settings, define_circular_tubular_structure_settings, define_background_structure_settings
from u... | true | true |
1c1c4d1cb01c4382fb9d27e2f290f87f3a861086 | 4,533 | py | Python | data/prepare_data/prepare_ETL_all.py | TanKinh/CycleGan-handwriting_generation | df974b8ae1927f2dbe84345da7c3f3a8a567f138 | [
"BSD-3-Clause"
] | 3 | 2019-04-23T15:51:53.000Z | 2021-12-11T06:16:14.000Z | data/prepare_data/prepare_ETL_all.py | TanKinh/CycleGan-handwriting_generation | df974b8ae1927f2dbe84345da7c3f3a8a567f138 | [
"BSD-3-Clause"
] | null | null | null | data/prepare_data/prepare_ETL_all.py | TanKinh/CycleGan-handwriting_generation | df974b8ae1927f2dbe84345da7c3f3a8a567f138 | [
"BSD-3-Clause"
] | 1 | 2021-01-20T01:51:38.000Z | 2021-01-20T01:51:38.000Z | import os
import numpy as np
import codecs
from scipy.misc import imread, imsave
import scipy
from PIL import Image
from PIL import ImageDraw
from PIL import ImageFont
import json
import collections
import random
# import matplotlib.pyplot as plt
DATA = 'D:/work/data/Extracted/etl_952_singlechar_size_64/'
ratioA = 0.1... | 35.414063 | 267 | 0.667108 | import os
import numpy as np
import codecs
from scipy.misc import imread, imsave
import scipy
from PIL import Image
from PIL import ImageDraw
from PIL import ImageFont
import json
import collections
import random
DATA = 'D:/work/data/Extracted/etl_952_singlechar_size_64/'
ratioA = 0.1
ratioB = 0.1
ratioALL = 0.2
def... | true | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.