hexsha stringlengths 40 40 | size int64 2 1.02M | ext stringclasses 10
values | lang stringclasses 1
value | max_stars_repo_path stringlengths 4 245 | max_stars_repo_name stringlengths 6 130 | max_stars_repo_head_hexsha stringlengths 40 40 | max_stars_repo_licenses listlengths 1 10 | max_stars_count int64 1 191k ⌀ | max_stars_repo_stars_event_min_datetime stringlengths 24 24 ⌀ | max_stars_repo_stars_event_max_datetime stringlengths 24 24 ⌀ | max_issues_repo_path stringlengths 4 245 | max_issues_repo_name stringlengths 6 130 | max_issues_repo_head_hexsha stringlengths 40 40 | max_issues_repo_licenses listlengths 1 10 | max_issues_count int64 1 67k ⌀ | max_issues_repo_issues_event_min_datetime stringlengths 24 24 ⌀ | max_issues_repo_issues_event_max_datetime stringlengths 24 24 ⌀ | max_forks_repo_path stringlengths 4 245 | max_forks_repo_name stringlengths 6 130 | max_forks_repo_head_hexsha stringlengths 40 40 | max_forks_repo_licenses listlengths 1 10 | max_forks_count int64 1 105k ⌀ | max_forks_repo_forks_event_min_datetime stringlengths 24 24 ⌀ | max_forks_repo_forks_event_max_datetime stringlengths 24 24 ⌀ | content stringlengths 2 1.02M | avg_line_length float64 1 417k | max_line_length int64 1 987k | alphanum_fraction float64 0 1 | content_no_comment stringlengths 0 1.01M | is_comment_constant_removed bool 1
class | is_sharp_comment_removed bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f74cfd0346d92ca9acb430da8e67b4125c5280ad | 14,177 | py | Python | EPMS_DBMS.py | Nishit014/EPMS | bcc8bf12b34dd3c3ebcfed4ff14cfc337590afa4 | [
"MIT"
] | 1 | 2021-06-27T11:54:02.000Z | 2021-06-27T11:54:02.000Z | EPMS_DBMS.py | Nishit014/EPMS-DBMS | bcc8bf12b34dd3c3ebcfed4ff14cfc337590afa4 | [
"MIT"
] | null | null | null | EPMS_DBMS.py | Nishit014/EPMS-DBMS | bcc8bf12b34dd3c3ebcfed4ff14cfc337590afa4 | [
"MIT"
] | 1 | 2021-06-26T12:40:30.000Z | 2021-06-26T12:40:30.000Z | from tkinter import *
import sqlite3
#import matplotlib.pyplot as plt
#import pandas as pd
from datetime import *
from tkinter import messagebox
#root=Tk()
#root.configure(bg='gray27')
#root.title('EPMS')
#conn=sqlite3.connect('epms.db')
def main():
def emp():
def back():
top.destroy... | 38.734973 | 170 | 0.523242 | from tkinter import *
import sqlite3
from datetime import *
from tkinter import messagebox
def main():
def emp():
def back():
top.destroy()
main()
def new():
def back2():
n.destroy()
... | true | true |
f74cfea789c4ec41c787366d22438095c3456106 | 1,211 | py | Python | napari/layers/_shapes_layer/_constants.py | donovanr/napari | 580b5eab8cc40af53aef780a65adb9216d968a32 | [
"BSD-3-Clause"
] | null | null | null | napari/layers/_shapes_layer/_constants.py | donovanr/napari | 580b5eab8cc40af53aef780a65adb9216d968a32 | [
"BSD-3-Clause"
] | null | null | null | napari/layers/_shapes_layer/_constants.py | donovanr/napari | 580b5eab8cc40af53aef780a65adb9216d968a32 | [
"BSD-3-Clause"
] | null | null | null | from enum import Enum
import sys
class Mode(Enum):
"""MODE: Interactive mode. The normal, default mode is PAN_ZOOM, which
allows for normal interactivity with the canvas.
The SELECT mode allows for entire shapes to be selected, moved and
resized.
The DIRECT mode allows for shapes to be selected ... | 26.326087 | 74 | 0.69777 | from enum import Enum
import sys
class Mode(Enum):
PAN_ZOOM = 0
SELECT = 1
DIRECT = 2
ADD_RECTANGLE = 3
ADD_ELLIPSE = 4
ADD_LINE = 5
ADD_PATH = 6
ADD_POLYGON = 7
VERTEX_INSERT = 8
VERTEX_REMOVE = 9
BOX_WITH_HANDLE = [0, 1, 2, 3, 4, 5, 6, 7, 9]
BOX_LINE_HANDLE = [1, 2, 4, 6, 0... | true | true |
f74cfec703b2ba702f4707e0c2059fdd644e14b2 | 226 | py | Python | katas/beta/count_consecutive_characters.py | the-zebulan/CodeWars | 1eafd1247d60955a5dfb63e4882e8ce86019f43a | [
"MIT"
] | 40 | 2016-03-09T12:26:20.000Z | 2022-03-23T08:44:51.000Z | katas/beta/count_consecutive_characters.py | akalynych/CodeWars | 1eafd1247d60955a5dfb63e4882e8ce86019f43a | [
"MIT"
] | null | null | null | katas/beta/count_consecutive_characters.py | akalynych/CodeWars | 1eafd1247d60955a5dfb63e4882e8ce86019f43a | [
"MIT"
] | 36 | 2016-11-07T19:59:58.000Z | 2022-03-31T11:18:27.000Z | from itertools import groupby
def count_consecutives(s):
return ''.join(str(sum(1 for _ in g)) + k for k, g in groupby(s))
# PEP8: kata should use snake_case instead of mixedCase
countConsecutives = count_consecutives
| 22.6 | 69 | 0.743363 | from itertools import groupby
def count_consecutives(s):
return ''.join(str(sum(1 for _ in g)) + k for k, g in groupby(s))
countConsecutives = count_consecutives
| true | true |
f74cff212d3aa5ae19c1f4a2695ca6996501ba18 | 159 | py | Python | Session7/Day1/foo/code.py | rmorgan10/LSSTC-DSFP-Sessions | 1d0b3c28fe7f6f93e00e332e74873e6d1ec29d0b | [
"MIT"
] | null | null | null | Session7/Day1/foo/code.py | rmorgan10/LSSTC-DSFP-Sessions | 1d0b3c28fe7f6f93e00e332e74873e6d1ec29d0b | [
"MIT"
] | null | null | null | Session7/Day1/foo/code.py | rmorgan10/LSSTC-DSFP-Sessions | 1d0b3c28fe7f6f93e00e332e74873e6d1ec29d0b | [
"MIT"
] | null | null | null | from numpy import pi
def do_something():
π = pi
print(π)# this will make it much easier in future problems to see that something is actually happening
| 31.8 | 106 | 0.742138 | from numpy import pi
def do_something():
π = pi
print(π)
| true | true |
f74cffe5a6279946fb16760be492a3f549feb470 | 132 | py | Python | portfolio/urls.py | petersoleeh/WIP | 8b7f1227b8d5322487677dc3b6aa1c8ce9ead91a | [
"MIT"
] | null | null | null | portfolio/urls.py | petersoleeh/WIP | 8b7f1227b8d5322487677dc3b6aa1c8ce9ead91a | [
"MIT"
] | null | null | null | portfolio/urls.py | petersoleeh/WIP | 8b7f1227b8d5322487677dc3b6aa1c8ce9ead91a | [
"MIT"
] | null | null | null | from django.conf.urls import url
from . import views
urlpatterns=[
#The landing page
url(r'^$',views.index,name='index')
]
| 16.5 | 39 | 0.681818 | from django.conf.urls import url
from . import views
urlpatterns=[
url(r'^$',views.index,name='index')
]
| true | true |
f74d00493cf7a39b3f2651657177430a43caf9ce | 808 | py | Python | jsinclude/templatetags/pkg/utils.py | cobbdb/jsinclude | 7a979677359df18b755190ed569b09d0ea8dad07 | [
"MIT"
] | null | null | null | jsinclude/templatetags/pkg/utils.py | cobbdb/jsinclude | 7a979677359df18b755190ed569b09d0ea8dad07 | [
"MIT"
] | null | null | null | jsinclude/templatetags/pkg/utils.py | cobbdb/jsinclude | 7a979677359df18b755190ed569b09d0ea8dad07 | [
"MIT"
] | null | null | null | def stripQuotes(string):
"""Strip leading and trailing quotes from a string.
Does nothing unless starting and ending quotes are present and
the same type (single or double).
"""
single = string.startswith("'") and string.endswith("'")
double = string.startswith('"') and string.endswith('"'... | 31.076923 | 67 | 0.623762 | def stripQuotes(string):
single = string.startswith("'") and string.endswith("'")
double = string.startswith('"') and string.endswith('"')
if single or double:
return string[1:-1]
return string
def escapeQuotes(string):
try:
return string.replace("'", "\\'")
except Att... | true | true |
f74d015228eab6997290a8b257cce327a871a694 | 6,500 | py | Python | python/complex-numbers/complex_numbers_test.py | tamireinhorn/exercism | 3ca78b262ad590b67c75c5d1cd83db02bc2d1e6e | [
"MIT"
] | null | null | null | python/complex-numbers/complex_numbers_test.py | tamireinhorn/exercism | 3ca78b262ad590b67c75c5d1cd83db02bc2d1e6e | [
"MIT"
] | 2 | 2021-12-18T16:31:51.000Z | 2021-12-18T16:33:33.000Z | python/complex-numbers/complex_numbers_test.py | tamireinhorn/Exercism | 3a3d5744e88ab4457df4e6ac20d772d8c50c43da | [
"MIT"
] | null | null | null | import math
import unittest
from complex_numbers import (
ComplexNumber,
)
# Tests adapted from `problem-specifications//canonical-data.json`
class ComplexNumbersTest(unittest.TestCase):
# Real part
def test_real_part_of_a_purely_real_number(self):
self.assertEqual(ComplexNumber(1, 0).real, ... | 34.031414 | 88 | 0.707231 | import math
import unittest
from complex_numbers import (
ComplexNumber,
)
class ComplexNumbersTest(unittest.TestCase):
def test_real_part_of_a_purely_real_number(self):
self.assertEqual(ComplexNumber(1, 0).real, 1)
def test_real_part_of_a_purely_imaginary_number(self):
self.a... | true | true |
f74d01b34d0b948711be5cf52e76a3ff134b5c32 | 471 | py | Python | Medium/1167. Minimum Cost to Connect Sticks/solution (1).py | czs108/LeetCode-Solutions | 889f5b6a573769ad077a6283c058ed925d52c9ec | [
"MIT"
] | 3 | 2020-05-09T12:55:09.000Z | 2022-03-11T18:56:05.000Z | Medium/1167. Minimum Cost to Connect Sticks/solution (1).py | czs108/LeetCode-Solutions | 889f5b6a573769ad077a6283c058ed925d52c9ec | [
"MIT"
] | null | null | null | Medium/1167. Minimum Cost to Connect Sticks/solution (1).py | czs108/LeetCode-Solutions | 889f5b6a573769ad077a6283c058ed925d52c9ec | [
"MIT"
] | 1 | 2022-03-11T18:56:16.000Z | 2022-03-11T18:56:16.000Z | # 1167. Minimum Cost to Connect Sticks
import heapq
class Solution:
# Greedy | Heap
def connectSticks(self, sticks: list[int]) -> int:
heapq.heapify(sticks)
cost = 0
while len(sticks) > 1:
# Always pick two of the smallest sticks to connect.
stick1, stick2 = h... | 27.705882 | 73 | 0.602972 |
import heapq
class Solution:
def connectSticks(self, sticks: list[int]) -> int:
heapq.heapify(sticks)
cost = 0
while len(sticks) > 1:
stick1, stick2 = heapq.heappop(sticks), heapq.heappop(sticks)
cost += stick1 + stick2
heapq.heappus... | true | true |
f74d01e15784d436a563807618590b57448c0f48 | 3,730 | py | Python | xos/core/dashboard/views/interactions.py | xmaruto/mcord | 3678a3d10c3703c2b73f396c293faebf0c82a4f4 | [
"Apache-2.0"
] | null | null | null | xos/core/dashboard/views/interactions.py | xmaruto/mcord | 3678a3d10c3703c2b73f396c293faebf0c82a4f4 | [
"Apache-2.0"
] | 5 | 2020-06-05T17:47:15.000Z | 2021-09-23T23:21:27.000Z | xos/core/dashboard/views/interactions.py | pan2za/xos | c2a4da2ccaa12360b2718be303b247866aefdfe6 | [
"Apache-2.0"
] | null | null | null | from view_common import *
class DashboardSliceInteractions(View):
def get(self, request, name="users", **kwargs):
colors = ["#005586", "#6ebe49", "orange", "#707170", "#00c4b3", "#077767", "dodgerblue", "#a79b94", "#c4e76a", "red"]
groups = []
matrix = []
slices = list(Slice.object... | 35.865385 | 125 | 0.551743 | from view_common import *
class DashboardSliceInteractions(View):
def get(self, request, name="users", **kwargs):
colors = ["#005586", "#6ebe49", "orange", "#707170", "#00c4b3", "#077767", "dodgerblue", "#a79b94", "#c4e76a", "red"]
groups = []
matrix = []
slices = list(Slice.object... | true | true |
f74d025eb05b6b97ac22b14e97db453556d0d970 | 405 | py | Python | src/monitoring.py | jagadeesh6jaga/vakyansh-realtime-server | a914adb29570ded792f4692c595527492c99b8c6 | [
"MIT"
] | null | null | null | src/monitoring.py | jagadeesh6jaga/vakyansh-realtime-server | a914adb29570ded792f4692c595527492c99b8c6 | [
"MIT"
] | null | null | null | src/monitoring.py | jagadeesh6jaga/vakyansh-realtime-server | a914adb29570ded792f4692c595527492c99b8c6 | [
"MIT"
] | null | null | null | import time
from src import log_setup
LOGGER = log_setup.get_logger(__name__)
def monitor(func):
def wrapped_function(*args, **kwargs):
start = time.monotonic_ns()
return_value = func(*args, **kwargs)
LOGGER.info(
f'function {func.__name__} took {(time.monotonic_ns() - start)... | 23.823529 | 101 | 0.666667 | import time
from src import log_setup
LOGGER = log_setup.get_logger(__name__)
def monitor(func):
def wrapped_function(*args, **kwargs):
start = time.monotonic_ns()
return_value = func(*args, **kwargs)
LOGGER.info(
f'function {func.__name__} took {(time.monotonic_ns() - start)... | true | true |
f74d025fc102159173e84e6023fcc9058865349c | 268 | py | Python | utils/util.py | daili0015/ModelFeast | 0689ced4d0f37be438d3a91908e5e4cc5b7d54b8 | [
"MIT"
] | 247 | 2019-03-05T07:12:29.000Z | 2022-03-29T01:51:17.000Z | utils/util.py | jungerschwarz/ModelFeast | 03afca0b129532135910ee2ac72a3b85be795289 | [
"MIT"
] | 8 | 2019-05-21T03:05:27.000Z | 2021-12-09T03:22:51.000Z | utils/util.py | jungerschwarz/ModelFeast | 03afca0b129532135910ee2ac72a3b85be795289 | [
"MIT"
] | 47 | 2019-03-05T07:14:13.000Z | 2021-11-11T01:04:28.000Z | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
def ensure_dir(path):
if not os.path.exists(path):
os.makedirs(path)
def get_instance(module, name, config, *args):
return getattr(module, config[name]['type'])(*args, **config[name]['args'])
| 20.615385 | 79 | 0.63806 |
import os
def ensure_dir(path):
if not os.path.exists(path):
os.makedirs(path)
def get_instance(module, name, config, *args):
return getattr(module, config[name]['type'])(*args, **config[name]['args'])
| true | true |
f74d032d9362b09343651bbdd34e19ded7d8e7bf | 1,726 | py | Python | src/python/socket_debugger_generator.py | textX/viewX-vscode | e19fc2d3f21aaab13aa3271a0670b7b1bf2705ae | [
"MIT"
] | 6 | 2019-10-02T16:20:45.000Z | 2022-01-09T09:24:07.000Z | src/python/socket_debugger_generator.py | danielkupco/viewX-vscode | e19fc2d3f21aaab13aa3271a0670b7b1bf2705ae | [
"MIT"
] | 3 | 2017-11-05T16:48:03.000Z | 2019-02-18T16:38:11.000Z | src/python/socket_debugger_generator.py | textX/viewX-vscode | e19fc2d3f21aaab13aa3271a0670b7b1bf2705ae | [
"MIT"
] | 1 | 2022-01-09T09:24:11.000Z | 2022-01-09T09:24:11.000Z | import sys
from os.path import abspath, dirname, join
from os import makedirs
import datetime
import jinja2
from shutil import copytree
ROOT_PATH = abspath(dirname(__file__))
TEMPLATE_PATH = abspath(join(ROOT_PATH, 'templates'))
# pair of template name and output file name
TEMPLATE_DATA = [
('socket_debugger.temp... | 29.254237 | 79 | 0.6854 | import sys
from os.path import abspath, dirname, join
from os import makedirs
import datetime
import jinja2
from shutil import copytree
ROOT_PATH = abspath(dirname(__file__))
TEMPLATE_PATH = abspath(join(ROOT_PATH, 'templates'))
TEMPLATE_DATA = [
('socket_debugger.template', 'socket-debugger.html')
]
PROJECT_P... | true | true |
f74d05b4ae9d00e909bd5abdc0b5832021d3d9e4 | 24,229 | py | Python | scripts/stop_user_clusters-v6.py | smartcommunitylab/sco.mobilitycovid | a4af6b3b2d14208d638894a94b2c673397bf77fd | [
"Apache-2.0"
] | null | null | null | scripts/stop_user_clusters-v6.py | smartcommunitylab/sco.mobilitycovid | a4af6b3b2d14208d638894a94b2c673397bf77fd | [
"Apache-2.0"
] | null | null | null | scripts/stop_user_clusters-v6.py | smartcommunitylab/sco.mobilitycovid | a4af6b3b2d14208d638894a94b2c673397bf77fd | [
"Apache-2.0"
] | 1 | 2021-01-19T09:22:15.000Z | 2021-01-19T09:22:15.000Z | from __future__ import print_function
from sklearn.cluster import DBSCAN
import argparse
import hashlib
import os
import time
from datetime import date, datetime, timedelta
from functools import reduce
from math import degrees
from concurrent.futures import ThreadPoolExecutor
import concurrent.futures
from azure.st... | 39.525285 | 218 | 0.624541 | from __future__ import print_function
from sklearn.cluster import DBSCAN
import argparse
import hashlib
import os
import time
from datetime import date, datetime, timedelta
from functools import reduce
from math import degrees
from concurrent.futures import ThreadPoolExecutor
import concurrent.futures
from azure.st... | true | true |
f74d072e8e2329c29dd755d044ee2ed1308e622d | 26,565 | py | Python | tensorflow/python/framework/func_graph.py | aeverall/tensorflow | 7992bf97711919f56f80bff9e5510cead4ab2095 | [
"Apache-2.0"
] | 1 | 2018-12-06T16:34:59.000Z | 2018-12-06T16:34:59.000Z | tensorflow/python/framework/func_graph.py | aeverall/tensorflow | 7992bf97711919f56f80bff9e5510cead4ab2095 | [
"Apache-2.0"
] | null | null | null | tensorflow/python/framework/func_graph.py | aeverall/tensorflow | 7992bf97711919f56f80bff9e5510cead4ab2095 | [
"Apache-2.0"
] | null | null | null | # Copyright 2018 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... | 41.186047 | 92 | 0.704837 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import collections
import weakref
from tensorflow.core.framework import attr_value_pb2
from tensorflow.python.eager import context
from tensorflow.python.eager import tape
from tensorflow.python... | true | true |
f74d078ef1fbd3e1376f3ee6b2e4b73709423dc6 | 1,869 | py | Python | share/qt/extract_strings_qt.py | genteshare-project/genteshare | b1407e7977c52bac52326cec9c7243877d0b273d | [
"MIT"
] | 3 | 2018-05-04T01:33:30.000Z | 2018-08-08T14:54:21.000Z | share/qt/extract_strings_qt.py | genteshare-project/genteshare | b1407e7977c52bac52326cec9c7243877d0b273d | [
"MIT"
] | null | null | null | share/qt/extract_strings_qt.py | genteshare-project/genteshare | b1407e7977c52bac52326cec9c7243877d0b273d | [
"MIT"
] | 1 | 2019-08-18T00:42:19.000Z | 2019-08-18T00:42:19.000Z | #!/usr/bin/python
'''
Extract _("...") strings for translation and convert to Qt4 stringdefs so that
they can be picked up by Qt linguist.
'''
from subprocess import Popen, PIPE
import glob
import operator
import os
import sys
OUT_CPP="qt/gentesharestrings.cpp"
EMPTY=['""']
def parse_po(text):
"""
Parse 'po' ... | 23.658228 | 83 | 0.599786 |
from subprocess import Popen, PIPE
import glob
import operator
import os
import sys
OUT_CPP="qt/gentesharestrings.cpp"
EMPTY=['""']
def parse_po(text):
messages = []
msgid = []
msgstr = []
in_msgid = False
in_msgstr = False
for line in text.split('\n'):
line = line.rstrip('\r')
... | true | true |
f74d09353cc6f3436d0b220becdea030aa01bad5 | 2,111 | py | Python | tests/st/networks/models/alexnet.py | unseenme/mindspore | 4ba052f0cd9146ac0ccc4880a778706f1b2d0af8 | [
"Apache-2.0"
] | 2 | 2020-04-28T03:49:10.000Z | 2020-04-28T03:49:13.000Z | tests/st/networks/models/alexnet.py | unseenme/mindspore | 4ba052f0cd9146ac0ccc4880a778706f1b2d0af8 | [
"Apache-2.0"
] | null | null | null | tests/st/networks/models/alexnet.py | unseenme/mindspore | 4ba052f0cd9146ac0ccc4880a778706f1b2d0af8 | [
"Apache-2.0"
] | null | null | null | # Copyright 2019 Huawei Technologies Co., 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 a... | 37.035088 | 79 | 0.578399 |
import mindspore.nn as nn
from mindspore.ops import operations as P
from mindspore.nn import Dense
class AlexNet(nn.Cell):
def __init__(self, num_classes=10):
super(AlexNet, self).__init__()
self.batch_size = 32
self.conv1 = nn.Conv2d(3, 96, 11, stride=4, pad_mode="v... | true | true |
f74d0a5aa7455ecf8ce47b07a5a063cf945fbc01 | 2,021 | py | Python | models/GraphUNet.py | qbxlvnf11/graph-neural-networks-for-graph-classification | 5d69ead58c786aa8e472ab0433156fe09fe6ca4b | [
"MIT"
] | 20 | 2020-09-02T07:07:35.000Z | 2022-03-16T15:22:14.000Z | models/GraphUNet.py | yuexiarenjing/graph-neural-networks-for-graph-classification | 5d69ead58c786aa8e472ab0433156fe09fe6ca4b | [
"MIT"
] | 2 | 2021-11-01T08:32:10.000Z | 2022-03-25T04:29:35.000Z | models/GraphUNet.py | yuexiarenjing/graph-neural-networks-for-graph-classification | 5d69ead58c786aa8e472ab0433156fe09fe6ca4b | [
"MIT"
] | 11 | 2020-09-02T07:13:46.000Z | 2022-03-23T10:38:07.000Z | import os
import sys
sys.path.append(os.path.dirname(os.path.abspath(os.path.dirname(__file__))))
import torch.nn as nn
import torch.nn.functional as F
#from layers.graph_convolution_layer import GraphConvolutionLayer
from layers.graph_unet_layer import GraphUNetLayer
from readouts.basic_readout import readout_functi... | 30.621212 | 110 | 0.59525 | import os
import sys
sys.path.append(os.path.dirname(os.path.abspath(os.path.dirname(__file__))))
import torch.nn as nn
import torch.nn.functional as F
from layers.graph_unet_layer import GraphUNetLayer
from readouts.basic_readout import readout_function
class GraphUNet(nn.Module):
def __init__(self, n_feat, n... | true | true |
f74d0bdef1ded2e9c75d7707abfe28677ab055f7 | 601 | py | Python | P17043-class-leader/self_small_trainning/20181118.py | 13022108937/homework | 05b3c0535532766b286976b15245ed1f925da8c5 | [
"Apache-2.0"
] | null | null | null | P17043-class-leader/self_small_trainning/20181118.py | 13022108937/homework | 05b3c0535532766b286976b15245ed1f925da8c5 | [
"Apache-2.0"
] | null | null | null | P17043-class-leader/self_small_trainning/20181118.py | 13022108937/homework | 05b3c0535532766b286976b15245ed1f925da8c5 | [
"Apache-2.0"
] | null | null | null | # 给定一个不超过5位的正整数,判断该数的位数,依次打印出十位,百位千位,万位的数字
num = int(input(':>> '))
length = len(str(num))
if num < 100000 and num>=0:
for x in range(length):
print(num%10)
num //= 10
num = int(input(':>> '))
length = len(str(num))
if num < 100000 and num >= 0:
for x in range(length):
tmp = num // 1... | 18.78125 | 44 | 0.494176 |
num = int(input(':>> '))
length = len(str(num))
if num < 100000 and num>=0:
for x in range(length):
print(num%10)
num //= 10
num = int(input(':>> '))
length = len(str(num))
if num < 100000 and num >= 0:
for x in range(length):
tmp = num // 10
print(num - ( tmp *10))
nu... | true | true |
f74d0c24ed6660662b6af5e515ec032812b7061c | 8,884 | py | Python | contrib/opencensus-ext-azure/opencensus/ext/azure/log_exporter/__init__.py | TheJokersThief/opencensus-python | 511289fa4cc4bbd6e013c8a33c5dc570a895ed2c | [
"Apache-2.0"
] | null | null | null | contrib/opencensus-ext-azure/opencensus/ext/azure/log_exporter/__init__.py | TheJokersThief/opencensus-python | 511289fa4cc4bbd6e013c8a33c5dc570a895ed2c | [
"Apache-2.0"
] | null | null | null | contrib/opencensus-ext-azure/opencensus/ext/azure/log_exporter/__init__.py | TheJokersThief/opencensus-python | 511289fa4cc4bbd6e013c8a33c5dc570a895ed2c | [
"Apache-2.0"
] | null | null | null | # Copyright 2019, OpenCensus Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | 35.678715 | 78 | 0.622467 |
import logging
import random
import threading
import time
import traceback
from opencensus.common.schedule import Queue, QueueEvent, QueueExitEvent
from opencensus.ext.azure.common import Options, utils
from opencensus.ext.azure.common.processor import ProcessorMixin
from opencensus.ext.azure.common.prot... | true | true |
f74d0c46435c066f97449e6aebd72a2a5e7e5bf9 | 4,329 | py | Python | src/zeit/push/testing.py | ZeitOnline/zeit.push | b36d7ae1f172ffbd4e1f3d873b27831516c13054 | [
"BSD-3-Clause"
] | null | null | null | src/zeit/push/testing.py | ZeitOnline/zeit.push | b36d7ae1f172ffbd4e1f3d873b27831516c13054 | [
"BSD-3-Clause"
] | 10 | 2016-08-05T05:46:30.000Z | 2019-02-12T15:24:18.000Z | src/zeit/push/testing.py | ZeitOnline/zeit.push | b36d7ae1f172ffbd4e1f3d873b27831516c13054 | [
"BSD-3-Clause"
] | 1 | 2017-02-23T11:52:36.000Z | 2017-02-23T11:52:36.000Z | import gocept.selenium
import logging
import pkg_resources
import plone.testing
import urlparse
import zeit.cms.testing
import zeit.content.text.jinja
import zeit.push.interfaces
import zeit.workflow.testing
import zope.interface
log = logging.getLogger(__name__)
class PushNotifier(object):
zope.interface.impl... | 31.830882 | 77 | 0.685609 | import gocept.selenium
import logging
import pkg_resources
import plone.testing
import urlparse
import zeit.cms.testing
import zeit.content.text.jinja
import zeit.push.interfaces
import zeit.workflow.testing
import zope.interface
log = logging.getLogger(__name__)
class PushNotifier(object):
zope.interface.impl... | true | true |
f74d0d5b68f196c39781bb76b06d19f6849b1602 | 7,863 | py | Python | ISR/utils/datahandler.py | supertopdev/data-science | 76aaa67289cbb8c608b190e6409a8c001c78ac6c | [
"Apache-2.0"
] | 1 | 2019-08-27T18:06:08.000Z | 2019-08-27T18:06:08.000Z | ISR/utils/datahandler.py | DoDuy/image-super-resolution | 9534085236a79e123b97f0771a4641289039d93b | [
"Apache-2.0"
] | null | null | null | ISR/utils/datahandler.py | DoDuy/image-super-resolution | 9534085236a79e123b97f0771a4641289039d93b | [
"Apache-2.0"
] | null | null | null | import os
import imageio
import numpy as np
from ISR.utils.logger import get_logger
class DataHandler:
"""
DataHandler generate augmented batches used for training or validation.
Args:
lr_dir: directory containing the Low Res images.
hr_dir: directory containing the High Res images.
... | 38.73399 | 108 | 0.57548 | import os
import imageio
import numpy as np
from ISR.utils.logger import get_logger
class DataHandler:
def __init__(self, lr_dir, hr_dir, patch_size, scale, n_validation_samples=None, T=0.03):
self.folders = {'hr': hr_dir, 'lr': lr_dir}
self.extensions = ('.png', '.jpeg', '.jpg')
self... | true | true |
f74d0d8bd0fd329871ecb686b49a9ba97f819f7c | 2,698 | py | Python | tensorflow_asr/utils/env_util.py | vaibhav016/TensorFlowASR | 2c90f67f284be6c8a6c182223b9f517a73bc766f | [
"Apache-2.0"
] | 1 | 2021-11-30T16:04:53.000Z | 2021-11-30T16:04:53.000Z | tensorflow_asr/utils/env_util.py | vaibhav016/TensorFlowASR | 2c90f67f284be6c8a6c182223b9f517a73bc766f | [
"Apache-2.0"
] | null | null | null | tensorflow_asr/utils/env_util.py | vaibhav016/TensorFlowASR | 2c90f67f284be6c8a6c182223b9f517a73bc766f | [
"Apache-2.0"
] | 1 | 2021-08-17T14:53:33.000Z | 2021-08-17T14:53:33.000Z | # Copyright 2020 Huy Le Nguyen (@usimarit)
#
# 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 t... | 34.151899 | 105 | 0.705337 |
from typing import Union, List
import warnings
import tensorflow as tf
logger = tf.get_logger()
def setup_environment():
warnings.simplefilter("ignore")
logger.setLevel("WARN")
def setup_devices(devices: List[int], cpu: bool = False):
if cpu:
cpus = tf.config.list_physical_devic... | true | true |
f74d0d91edb3804e7987bee2219f21d5c8102185 | 612 | py | Python | tests/flatpages/test_models.py | jeanmask/opps | 031c6136c38d43aa6d1ccb25a94f7bcd65ccbf87 | [
"MIT"
] | 159 | 2015-01-03T16:36:35.000Z | 2022-03-29T20:50:13.000Z | tests/flatpages/test_models.py | jeanmask/opps | 031c6136c38d43aa6d1ccb25a94f7bcd65ccbf87 | [
"MIT"
] | 81 | 2015-01-02T21:26:16.000Z | 2021-05-29T12:24:52.000Z | tests/flatpages/test_models.py | jeanmask/opps | 031c6136c38d43aa6d1ccb25a94f7bcd65ccbf87 | [
"MIT"
] | 75 | 2015-01-23T13:41:03.000Z | 2021-09-24T03:45:23.000Z | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.test import TestCase
from django.db import models
from opps.flatpages.models import FlatPage
class FlatPagesFields(TestCase):
def test_show_in_menu(self):
field = FlatPage._meta.get_field_by_name('show_in_menu')[0]
self.assertFalse(field.... | 27.818182 | 67 | 0.707516 |
from django.test import TestCase
from django.db import models
from opps.flatpages.models import FlatPage
class FlatPagesFields(TestCase):
def test_show_in_menu(self):
field = FlatPage._meta.get_field_by_name('show_in_menu')[0]
self.assertFalse(field.default)
def test_content(self):
... | true | true |
f74d0e6c1dc4274ac75d615be50d61a83f182e39 | 1,064 | py | Python | djangoerp/menus/tests/urls.py | xarala221/django-erp | f84ee8ab193b3b06ee4522ac3c888ed47396e795 | [
"MIT"
] | 345 | 2015-02-16T17:36:32.000Z | 2022-01-13T11:04:35.000Z | djangoerp/menus/tests/urls.py | xarala221/django-erp | f84ee8ab193b3b06ee4522ac3c888ed47396e795 | [
"MIT"
] | 22 | 2015-09-11T13:29:00.000Z | 2021-11-27T18:47:38.000Z | djangoerp/menus/tests/urls.py | xarala221/django-erp | f84ee8ab193b3b06ee4522ac3c888ed47396e795 | [
"MIT"
] | 243 | 2015-03-31T12:08:30.000Z | 2022-01-29T08:23:53.000Z | #!/usr/bin/env python
"""This file is part of the django ERP project.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLD... | 38 | 91 | 0.765038 |
__author__ = 'Emanuele Bertoldi <emanuele.bertoldi@gmail.com>'
__copyright__ = 'Copyright (c) 2013-2015, django ERP Team'
__version__ = '0.0.5'
from django.conf.urls import url
from django.views.generic import TemplateView
class BaseTemplateView(TemplateView):
template_name = "index.html"
urlpatterns = [
... | true | true |
f74d0edb06f8a572229657ad2751ad10217f0616 | 6,153 | py | Python | src/gluonts/model/deep_factor/_network.py | ykaitao/gluon-ts | 9622550974e9e0819e25438fc45353f8a6474b55 | [
"Apache-2.0"
] | 1 | 2020-01-19T13:27:51.000Z | 2020-01-19T13:27:51.000Z | src/gluonts/model/deep_factor/_network.py | ykaitao/gluon-ts | 9622550974e9e0819e25438fc45353f8a6474b55 | [
"Apache-2.0"
] | null | null | null | src/gluonts/model/deep_factor/_network.py | ykaitao/gluon-ts | 9622550974e9e0819e25438fc45353f8a6474b55 | [
"Apache-2.0"
] | null | null | null | # Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License").
# You may not use this file except in compliance with the License.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... | 31.880829 | 87 | 0.61661 |
import math
from mxnet.gluon import HybridBlock
from mxnet.gluon import nn
from gluonts.block.feature import FeatureEmbedder
from gluonts.core.component import validated
from gluonts.model.common import Tensor
class DeepFactorNetworkBase(HybridBlock):
def __init__(
self,
global_mod... | true | true |
f74d104fecd3101afb6f2b7b942c225d3b3a3f23 | 1,091 | py | Python | tests/cmdline_gen.py | ashusharmasigdev/libkernaux | efe96b5de9c30d7e65a7024df803bd40060e071d | [
"MIT"
] | 19 | 2021-12-15T05:06:13.000Z | 2022-01-22T01:46:47.000Z | tests/cmdline_gen.py | ashusharmasigdev/libkernaux | efe96b5de9c30d7e65a7024df803bd40060e071d | [
"MIT"
] | 26 | 2021-12-14T00:43:38.000Z | 2022-02-09T23:10:14.000Z | tests/cmdline_gen.py | ashusharmasigdev/libkernaux | efe96b5de9c30d7e65a7024df803bd40060e071d | [
"MIT"
] | 1 | 2022-01-11T20:50:36.000Z | 2022-01-11T20:50:36.000Z | from jinja2 import Environment, FileSystemLoader
from os import path
from yaml import SafeLoader, safe_load
CASES_FILENAME = 'cmdline.yml'
TEMPLATE_FILENAME = 'cmdline_gen.jinja'
TEST_FILENAME = 'test_cmdline_gen.c'
ROOT_DIRPATH = path.dirname(path.dirname(path.join(path.abspath(__file__))))
COMMON_DIRPATH = ... | 24.795455 | 76 | 0.707608 | from jinja2 import Environment, FileSystemLoader
from os import path
from yaml import SafeLoader, safe_load
CASES_FILENAME = 'cmdline.yml'
TEMPLATE_FILENAME = 'cmdline_gen.jinja'
TEST_FILENAME = 'test_cmdline_gen.c'
ROOT_DIRPATH = path.dirname(path.dirname(path.join(path.abspath(__file__))))
COMMON_DIRPATH = ... | true | true |
f74d105d98f75a8e01f01f3a6a382e2f5abcb120 | 2,605 | py | Python | homeassistant/components/mailgun/__init__.py | zalke/home-assistant | a31e49c857722c0723dc5297cd83cbce0f8716f6 | [
"Apache-2.0"
] | 4 | 2019-07-03T22:36:57.000Z | 2019-08-10T15:33:25.000Z | homeassistant/components/mailgun/__init__.py | zalke/home-assistant | a31e49c857722c0723dc5297cd83cbce0f8716f6 | [
"Apache-2.0"
] | 7 | 2019-08-23T05:26:02.000Z | 2022-03-11T23:57:18.000Z | homeassistant/components/mailgun/__init__.py | zalke/home-assistant | a31e49c857722c0723dc5297cd83cbce0f8716f6 | [
"Apache-2.0"
] | 2 | 2018-08-15T03:59:35.000Z | 2018-10-18T12:20:05.000Z | """Support for Mailgun."""
import hashlib
import hmac
import json
import logging
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassistant.const import CONF_API_KEY, CONF_DOMAIN, CONF_WEBHOOK_ID
from homeassistant.helpers import config_entry_flow
from .const import DOMAIN
_LO... | 27.421053 | 79 | 0.70096 | import hashlib
import hmac
import json
import logging
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassistant.const import CONF_API_KEY, CONF_DOMAIN, CONF_WEBHOOK_ID
from homeassistant.helpers import config_entry_flow
from .const import DOMAIN
_LOGGER = logging.getLogger(__... | true | true |
f74d117b16fd6e6d0a3879e6b01d13c5f03f026c | 934 | py | Python | appdaemon/lib/time_wrapper.py | snjoetw/appdaemon_apps | bfc318fac142e324e730d47b008167f738dd411d | [
"MIT"
] | null | null | null | appdaemon/lib/time_wrapper.py | snjoetw/appdaemon_apps | bfc318fac142e324e730d47b008167f738dd411d | [
"MIT"
] | null | null | null | appdaemon/lib/time_wrapper.py | snjoetw/appdaemon_apps | bfc318fac142e324e730d47b008167f738dd411d | [
"MIT"
] | null | null | null | class DateTimeWrapper:
def __init__(self, app, dt):
self._app = app
if isinstance(dt, str):
self._dt = self._parse_datetime(dt)
else:
self._dt = dt
def datetime(self):
return self._dt
def before(self, dt_str):
time = self._parse_datetime(dt_... | 27.470588 | 75 | 0.641328 | class DateTimeWrapper:
def __init__(self, app, dt):
self._app = app
if isinstance(dt, str):
self._dt = self._parse_datetime(dt)
else:
self._dt = dt
def datetime(self):
return self._dt
def before(self, dt_str):
time = self._parse_datetime(dt_... | true | true |
f74d12826fa1e124d77f701fb1f9e1d425bf9b89 | 824 | py | Python | 2017/01/17/Using Flask-WTForms With Flask-Bootstrap/flask_bootstrap/main.py | kenjitagawa/youtube_video_code | ef3c48b9e136b3745d10395d94be64cb0a1f1c97 | [
"Unlicense"
] | 492 | 2019-06-25T12:54:31.000Z | 2022-03-30T12:38:28.000Z | 2017/01/17/Using Flask-WTForms With Flask-Bootstrap/flask_bootstrap/main.py | kenjitagawa/youtube_video_code | ef3c48b9e136b3745d10395d94be64cb0a1f1c97 | [
"Unlicense"
] | 23 | 2019-10-01T01:36:08.000Z | 2022-02-10T12:46:16.000Z | 2017/01/17/Using Flask-WTForms With Flask-Bootstrap/flask_bootstrap/main.py | kenjitagawa/youtube_video_code | ef3c48b9e136b3745d10395d94be64cb0a1f1c97 | [
"Unlicense"
] | 1,734 | 2019-06-03T06:25:13.000Z | 2022-03-31T23:57:53.000Z | from flask import Flask, render_template
from flask_wtf import Form
from wtforms import StringField, PasswordField
from wtforms.validators import InputRequired, Email, Length, AnyOf
from flask_bootstrap import Bootstrap
app = Flask(__name__)
Bootstrap(app)
app.config['SECRET_KEY'] = 'DontTellAnyone'
class ... | 35.826087 | 122 | 0.731796 | from flask import Flask, render_template
from flask_wtf import Form
from wtforms import StringField, PasswordField
from wtforms.validators import InputRequired, Email, Length, AnyOf
from flask_bootstrap import Bootstrap
app = Flask(__name__)
Bootstrap(app)
app.config['SECRET_KEY'] = 'DontTellAnyone'
class ... | true | true |
f74d12c59af5ff96fff043d3d67bb55cb765b120 | 87 | py | Python | drfapp/apps.py | tanujnotes/lispay | c21b9345b9162ec5b7a955a1e2c0c3c92db6a47c | [
"MIT"
] | 1 | 2021-06-13T19:58:15.000Z | 2021-06-13T19:58:15.000Z | drfapp/apps.py | tanujnotes/lispay | c21b9345b9162ec5b7a955a1e2c0c3c92db6a47c | [
"MIT"
] | null | null | null | drfapp/apps.py | tanujnotes/lispay | c21b9345b9162ec5b7a955a1e2c0c3c92db6a47c | [
"MIT"
] | null | null | null | from django.apps import AppConfig
class DrfappConfig(AppConfig):
name = 'drfapp'
| 14.5 | 33 | 0.747126 | from django.apps import AppConfig
class DrfappConfig(AppConfig):
name = 'drfapp'
| true | true |
f74d1358a99c7830566491f1347c157a3c1c0c7e | 19,623 | py | Python | py_alg_dat/singly_linked_list.py | trycatchhorn/PyAlgDat | 85f8c7550630cf31b5e4472fd593956c9d96c078 | [
"MIT"
] | null | null | null | py_alg_dat/singly_linked_list.py | trycatchhorn/PyAlgDat | 85f8c7550630cf31b5e4472fd593956c9d96c078 | [
"MIT"
] | null | null | null | py_alg_dat/singly_linked_list.py | trycatchhorn/PyAlgDat | 85f8c7550630cf31b5e4472fd593956c9d96c078 | [
"MIT"
] | null | null | null | #!/usr/bin/python env
# The MIT License (MIT)
#
# Copyright (c) 2015 by Brian Horn, trycatchhorn@gmail.com.
#
# 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 w... | 35.103757 | 99 | 0.601998 |
__author__ = "Brian Horn"
__copyright__ = "Copyright (c) 2015 Brian Horn"
__credits__ = "Brian Horn"
__license__ = "MIT"
__version__ = "1.0.2"
__maintainer__ = "Brian Horn"
__email__ = "trycatchhorn@gmail.com"
__status__ = "Prototype"
from py_alg_dat.linked_list import LinkedList
class Singl... | true | true |
f74d13a606e2afb42557d35c2616514efe0e4be6 | 266 | py | Python | cluster/cluster1.py | dendisuhubdy/code-snippets | 12b99ac102f16a011f30bd94b4e42789225eaf7d | [
"MIT"
] | 2 | 2020-04-07T17:08:45.000Z | 2020-12-29T20:37:41.000Z | cluster/cluster1.py | dendisuhubdy/code-snippets | 12b99ac102f16a011f30bd94b4e42789225eaf7d | [
"MIT"
] | null | null | null | cluster/cluster1.py | dendisuhubdy/code-snippets | 12b99ac102f16a011f30bd94b4e42789225eaf7d | [
"MIT"
] | 1 | 2020-04-07T17:08:46.000Z | 2020-04-07T17:08:46.000Z | from __future__ import print_function
import pyslurm
def main():
try:
a = pyslurm.job()
jobs = a.get()
print(jobs)
except ValueError as e:
print("Job list error - {0}".format(e.args[0]))
if __name__=="__main__":
main()
| 17.733333 | 55 | 0.586466 | from __future__ import print_function
import pyslurm
def main():
try:
a = pyslurm.job()
jobs = a.get()
print(jobs)
except ValueError as e:
print("Job list error - {0}".format(e.args[0]))
if __name__=="__main__":
main()
| true | true |
f74d142b5436da42079c1aaa166901a6c1943760 | 223 | py | Python | examples/log_stdout.py | tierpod/easylogconfig | 0eb8f1eb3c6acd09ddacb553ef87b74ee5da48bd | [
"MIT"
] | null | null | null | examples/log_stdout.py | tierpod/easylogconfig | 0eb8f1eb3c6acd09ddacb553ef87b74ee5da48bd | [
"MIT"
] | 1 | 2020-05-22T06:25:11.000Z | 2020-05-22T11:08:45.000Z | examples/log_stdout.py | tierpod/easylogconfig | 0eb8f1eb3c6acd09ddacb553ef87b74ee5da48bd | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# coding: utf-8
import logging
import easylogconfig
log = logging.getLogger(__name__)
easylogconfig.auto(debug=True)
log.info("info message")
log.error("error message")
log.debug("debug message")
| 14.866667 | 33 | 0.753363 |
import logging
import easylogconfig
log = logging.getLogger(__name__)
easylogconfig.auto(debug=True)
log.info("info message")
log.error("error message")
log.debug("debug message")
| true | true |
f74d1482b5698ff1784e8f61001211fa3dff11a2 | 20,342 | py | Python | helpData_n2c2.py | yjc9696/biobert-my | ffc11c91f7032cffbcc7d9526159f0ff8e08c1f3 | [
"Apache-2.0"
] | null | null | null | helpData_n2c2.py | yjc9696/biobert-my | ffc11c91f7032cffbcc7d9526159f0ff8e08c1f3 | [
"Apache-2.0"
] | 3 | 2020-11-13T17:48:47.000Z | 2022-02-09T23:43:16.000Z | helpData_n2c2.py | yjc9696/biobert-my | ffc11c91f7032cffbcc7d9526159f0ff8e08c1f3 | [
"Apache-2.0"
] | null | null | null | import json
import numpy as np
import metrics
import tokenization
import utils
from config import opt
def write2file(data, path):
with open(path, 'w') as f:
f.write(json.dumps(data, ensure_ascii=False))
def get_BIO(self, tag):
return self.id2tag[tag]
# if tag == 0:
# return 'O'
# if ... | 40.929577 | 175 | 0.531462 | import json
import numpy as np
import metrics
import tokenization
import utils
from config import opt
def write2file(data, path):
with open(path, 'w') as f:
f.write(json.dumps(data, ensure_ascii=False))
def get_BIO(self, tag):
return self.id2tag[tag]
def detokenize(se... | true | true |
f74d1782f7ccea0856374780931e138f1c53872b | 198 | py | Python | dungeon_master_submit.py | ClusterFights/dungeon-master-challenge | cd4e0fc1f04c046eadc3b971dbaa03587318218d | [
"MIT"
] | null | null | null | dungeon_master_submit.py | ClusterFights/dungeon-master-challenge | cd4e0fc1f04c046eadc3b971dbaa03587318218d | [
"MIT"
] | 1 | 2019-04-23T20:24:27.000Z | 2019-04-23T20:24:27.000Z | dungeon_master_submit.py | ClusterFights/dungeon-master-challenge | cd4e0fc1f04c046eadc3b971dbaa03587318218d | [
"MIT"
] | 1 | 2019-04-23T20:21:18.000Z | 2019-04-23T20:21:18.000Z | import requests
import sys
res = requests.put("http://challenges.clusterfights.com/challenge/" + sys.argv[1], json={
"solution": {
"secret": sys.argv[2]
}
})
print(res.json()['runtime'])
| 18 | 89 | 0.651515 | import requests
import sys
res = requests.put("http://challenges.clusterfights.com/challenge/" + sys.argv[1], json={
"solution": {
"secret": sys.argv[2]
}
})
print(res.json()['runtime'])
| true | true |
f74d1785f4c3724cfd52549be35e2e86c75130d5 | 3,997 | py | Python | riemann/data/data_ingredient.py | jdieter31/riemannian-nlp | 75ef47608c81ec6e925fe24d16c67985e4b987c6 | [
"MIT"
] | 3 | 2020-02-02T09:02:12.000Z | 2021-07-24T03:38:35.000Z | riemann/data/data_ingredient.py | jdieter31/riemannian-nlp | 75ef47608c81ec6e925fe24d16c67985e4b987c6 | [
"MIT"
] | 1 | 2019-06-18T23:25:38.000Z | 2019-08-16T13:10:18.000Z | riemann/data/data_ingredient.py | jdieter31/riemannian-nlp | 75ef47608c81ec6e925fe24d16c67985e4b987c6 | [
"MIT"
] | 2 | 2020-01-02T07:14:37.000Z | 2020-06-25T15:50:08.000Z | from math import floor
import numpy as np
from .graph import load_edge_list, load_adjacency_matrix
from .graph_dataset import BatchedDataset
from ..config_loader import get_config
def load_dataset():
data_config = get_config().data
if graph_data_type == "edge":
idx, objects, weights = load_edge_lis... | 34.756522 | 90 | 0.618214 | from math import floor
import numpy as np
from .graph import load_edge_list, load_adjacency_matrix
from .graph_dataset import BatchedDataset
from ..config_loader import get_config
def load_dataset():
data_config = get_config().data
if graph_data_type == "edge":
idx, objects, weights = load_edge_lis... | true | true |
f74d1ac5806b3df08f57092c9a18ef1c0abce61d | 4,564 | py | Python | scripts/sources/s_checklist_scenariobased_step07.py | dpopadic/arpmRes | ddcc4de713b46e3e9dcb77cc08c502ce4df54f76 | [
"MIT"
] | 6 | 2021-04-10T13:24:30.000Z | 2022-03-26T08:20:42.000Z | scripts/sources/s_checklist_scenariobased_step07.py | dpopadic/arpmRes | ddcc4de713b46e3e9dcb77cc08c502ce4df54f76 | [
"MIT"
] | null | null | null | scripts/sources/s_checklist_scenariobased_step07.py | dpopadic/arpmRes | ddcc4de713b46e3e9dcb77cc08c502ce4df54f76 | [
"MIT"
] | 6 | 2019-08-13T22:02:17.000Z | 2022-02-09T17:49:12.000Z | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# ---
# jupyter:
# jupytext:
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.4'
# jupytext_version: 1.2.0
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
# # s_ch... | 32.140845 | 235 | 0.704207 |
squeeze()
else:
db_projection_tools = pd.read_csv(path + 'db_projection_bootstrap_tools.csv')
j_ = int(db_projection_tools['j_'][0])
db_scenprob = pd.read_csv(path + 'db_scenario_probs_bootstrap.csv')
p = db_scenprob['p'].values
db_pricing = pd.read_csv(path + 'db_pricin... | true | true |
f74d1af590bc5c4d9a6ff45609537069ffe3d097 | 77,634 | py | Python | google/cloud/compute_v1/services/disks/client.py | igor-solomatov/python-compute | 16e7294cd536af9a8bf8e4e99219a883339aa955 | [
"Apache-2.0"
] | null | null | null | google/cloud/compute_v1/services/disks/client.py | igor-solomatov/python-compute | 16e7294cd536af9a8bf8e4e99219a883339aa955 | [
"Apache-2.0"
] | null | null | null | google/cloud/compute_v1/services/disks/client.py | igor-solomatov/python-compute | 16e7294cd536af9a8bf8e4e99219a883339aa955 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | 43.37095 | 127 | 0.592176 |
from collections import OrderedDict
from distutils import util
import os
import re
from typing import Callable, Dict, Optional, Sequence, Tuple, Type, Union
import pkg_resources
from google.api_core import client_options as client_options_lib
from google.api_core import exceptions
from google.api_... | true | true |
f74d1b8fa8a368ca7d36ad0d1080768701df1f5d | 3,428 | py | Python | p3/management/commands/check_schedule.py | malemburg/epcon | 1edec493ac1258950dcabdc9f9ee8b97c24f96c5 | [
"BSD-2-Clause"
] | null | null | null | p3/management/commands/check_schedule.py | malemburg/epcon | 1edec493ac1258950dcabdc9f9ee8b97c24f96c5 | [
"BSD-2-Clause"
] | null | null | null | p3/management/commands/check_schedule.py | malemburg/epcon | 1edec493ac1258950dcabdc9f9ee8b97c24f96c5 | [
"BSD-2-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
""" Print accepted talks not scheduled and not accepted talks which have been
scheduled.
"""
from collections import defaultdict
from optparse import make_option
import operator
import simplejson as json
from django.core.management.base import BaseCommand, CommandError
from djan... | 40.809524 | 93 | 0.490665 |
from collections import defaultdict
from optparse import make_option
import operator
import simplejson as json
from django.core.management.base import BaseCommand, CommandError
from django.core import urlresolvers
from conference import models
from conference import utils
from conference.mo... | true | true |
f74d1d71291be40e5c29aae2b212ecf1f0fce797 | 8,443 | py | Python | docs/conf.py | ChattanoogaPublicLibrary/booksforcha | 1d4106acde35e3374b4a42ecb60798fcd279752e | [
"MIT"
] | null | null | null | docs/conf.py | ChattanoogaPublicLibrary/booksforcha | 1d4106acde35e3374b4a42ecb60798fcd279752e | [
"MIT"
] | 2 | 2015-03-31T14:07:15.000Z | 2015-04-01T03:08:39.000Z | docs/conf.py | ChattanoogaPublicLibrary/booksforcha | 1d4106acde35e3374b4a42ecb60798fcd279752e | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# booksforcha documentation build configuration file, created by
# sphinx-quickstart on Tue Jul 9 22:26:36 2013.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
#... | 30.59058 | 76 | 0.715978 |
import sys
import os
cwd = os.getcwd()
project_root = os.path.dirname(cwd)
sys.path.insert(0, project_root)
import booksforcha
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode']
templates_path = ['_templates']
source_suffix = '.rst'
master_doc = 'index'
project = u... | true | true |
f74d1f26b8f51907e5dc6cf864218245094285c1 | 4,058 | py | Python | python/data_sutram/scraper/appl_map.py | SayanGhoshBDA/code-backup | 8b6135facc0e598e9686b2e8eb2d69dd68198b80 | [
"MIT"
] | 16 | 2018-11-26T08:39:42.000Z | 2019-05-08T10:09:52.000Z | python/data_sutram/scraper/appl_map.py | SayanGhoshBDA/code-backup | 8b6135facc0e598e9686b2e8eb2d69dd68198b80 | [
"MIT"
] | 8 | 2020-05-04T06:29:26.000Z | 2022-02-12T05:33:16.000Z | python/data_sutram/scraper/appl_map.py | SayanGhoshBDA/code-backup | 8b6135facc0e598e9686b2e8eb2d69dd68198b80 | [
"MIT"
] | 5 | 2020-02-11T16:02:21.000Z | 2021-02-05T07:48:30.000Z | """
https://sat-cdn1.apple-mapkit.com/tile?style=7&size=1&scale=1&z=19&x=84135&y=202065&v=4002&accessKey=1549129912_6641142575737855346_%2F_9%2F4MX0U5yhJDc3LDXazhcQj3xjCJU%2BYsiKcviN%2FnWxE%3D&emphasis=standard&tint=dark
https://sat-cdn4.apple-mapkit.com/tile?style=7&size=1&scale=1&z=19&x=84135&y=202061&v=4002&accessK... | 47.186047 | 283 | 0.716116 | import urllib.request, urllib.parse, urllib.error
from bs4 import BeautifulSoup
import ssl
import os
import wget
import imghdr
import numpy as np
import requests
import time
ctx = ssl.create_default_context()
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE
import math
PI = math.pi
cdn = [1,2,3,4]
headers = ... | true | true |
f74d1f7442473997245ac683b8a269a3574d1ba4 | 2,678 | py | Python | crabageprediction/venv/Lib/site-packages/dateutil/easter.py | 13rianlucero/CrabAgePrediction | 92bc7fbe1040f49e820473e33cc3902a5a7177c7 | [
"MIT"
] | 18,636 | 2017-12-06T14:53:18.000Z | 2022-03-31T13:12:34.000Z | crabageprediction/venv/Lib/site-packages/dateutil/easter.py | 13rianlucero/CrabAgePrediction | 92bc7fbe1040f49e820473e33cc3902a5a7177c7 | [
"MIT"
] | 3,640 | 2017-12-06T16:58:35.000Z | 2022-03-31T22:20:57.000Z | crabageprediction/venv/Lib/site-packages/dateutil/easter.py | 13rianlucero/CrabAgePrediction | 92bc7fbe1040f49e820473e33cc3902a5a7177c7 | [
"MIT"
] | 1,987 | 2017-12-06T15:04:51.000Z | 2022-03-26T10:05:15.000Z | # -*- coding: utf-8 -*-
"""
This module offers a generic Easter computing method for any given year, using
Western, Orthodox or Julian algorithms.
"""
import datetime
__all__ = ["easter", "EASTER_JULIAN", "EASTER_ORTHODOX", "EASTER_WESTERN"]
EASTER_JULIAN = 1
EASTER_ORTHODOX = 2
EASTER_WESTERN = 3
def easter(year,... | 29.755556 | 79 | 0.587379 |
import datetime
__all__ = ["easter", "EASTER_JULIAN", "EASTER_ORTHODOX", "EASTER_WESTERN"]
EASTER_JULIAN = 1
EASTER_ORTHODOX = 2
EASTER_WESTERN = 3
def easter(year, method=EASTER_WESTERN):
if not (1 <= method <= 3):
raise ValueError("invalid method")
... | true | true |
f74d1f946e05a3c20906cb4194482f4391feedf8 | 3,733 | py | Python | scripts/validate_solutions.py | storyteller-aditya/hackathons | 008ba6bdd22e61c19eaec2426a48cf11a65eb9b0 | [
"CC-BY-4.0"
] | null | null | null | scripts/validate_solutions.py | storyteller-aditya/hackathons | 008ba6bdd22e61c19eaec2426a48cf11a65eb9b0 | [
"CC-BY-4.0"
] | null | null | null | scripts/validate_solutions.py | storyteller-aditya/hackathons | 008ba6bdd22e61c19eaec2426a48cf11a65eb9b0 | [
"CC-BY-4.0"
] | null | null | null | import argparse
import errno
import importlib
import logging
import os
import typing
from components import CheckSolver
logging.basicConfig(
format='%(asctime)s - %(message)s',
datefmt='%d-%b-%y %H:%M:%S',
level=logging.INFO
)
LOGGER = logging.getLogger()
SOLUTIONS_DIR = os.environ["SOLUTIONS_DIR"]
ATTRIBUTES... | 28.280303 | 73 | 0.753549 | import argparse
import errno
import importlib
import logging
import os
import typing
from components import CheckSolver
logging.basicConfig(
format='%(asctime)s - %(message)s',
datefmt='%d-%b-%y %H:%M:%S',
level=logging.INFO
)
LOGGER = logging.getLogger()
SOLUTIONS_DIR = os.environ["SOLUTIONS_DIR"]
ATTRIBUTES... | true | true |
f74d20fc89b8933a128bc9033164cfc838b20857 | 81 | py | Python | add/apps.py | thcoffee/aom2 | d5c45b9905d10906ba14c23f2cf6d29f9b90f60a | [
"Apache-2.0"
] | 2 | 2019-08-25T05:07:32.000Z | 2019-09-04T07:37:25.000Z | add/apps.py | thcoffee/aom2 | d5c45b9905d10906ba14c23f2cf6d29f9b90f60a | [
"Apache-2.0"
] | 1 | 2022-03-05T10:11:21.000Z | 2022-03-05T10:11:21.000Z | add/apps.py | thcoffee/aom2 | d5c45b9905d10906ba14c23f2cf6d29f9b90f60a | [
"Apache-2.0"
] | 1 | 2022-03-05T10:15:16.000Z | 2022-03-05T10:15:16.000Z | from django.apps import AppConfig
class AddConfig(AppConfig):
name = 'add'
| 13.5 | 33 | 0.728395 | from django.apps import AppConfig
class AddConfig(AppConfig):
name = 'add'
| true | true |
f74d21e06d8ab3916b257b5eaf790f3234bc964f | 1,550 | py | Python | tasks.py | edublancas/ploomber-workshop | 97a44bcda37557a9bee43c190c3383b7320575bb | [
"MIT"
] | 3 | 2021-10-30T13:45:56.000Z | 2021-12-11T19:55:14.000Z | tasks.py | edublancas/ploomber-workshop | 97a44bcda37557a9bee43c190c3383b7320575bb | [
"MIT"
] | 1 | 2021-08-16T23:41:52.000Z | 2021-08-16T23:41:52.000Z | tasks.py | edublancas/ploomber-workshop | 97a44bcda37557a9bee43c190c3383b7320575bb | [
"MIT"
] | 3 | 2021-08-16T23:37:34.000Z | 2021-09-18T19:58:09.000Z | from pathlib import Path
import shutil
from jinja2 import Template
from invoke import task
import jupytext
_TARGET = Path('~', 'dev', 'ploomber').expanduser()
@task
def setup(c, from_lock=False):
"""Create conda environment
"""
if from_lock:
c.run('conda env create --file environment.yml --force... | 24.603175 | 71 | 0.611613 | from pathlib import Path
import shutil
from jinja2 import Template
from invoke import task
import jupytext
_TARGET = Path('~', 'dev', 'ploomber').expanduser()
@task
def setup(c, from_lock=False):
if from_lock:
c.run('conda env create --file environment.yml --force')
else:
c.run('conda env cr... | true | true |
f74d247f1bc8154ca58c63a262a25033e6f687a5 | 4,996 | py | Python | tests/unit_tests/test_exchange_coinbase.py | Joel-max-s/pycryptobot | 58936a117ae0586304041cec10820545d41efa34 | [
"Apache-2.0"
] | 1,447 | 2021-01-04T08:08:37.000Z | 2022-03-26T12:28:36.000Z | tests/unit_tests/test_exchange_coinbase.py | joa-rodrigues/pycryptobot | 669f4a3c73eb0ac85f9e4261a093fd61c38ca7ab | [
"Apache-2.0"
] | 434 | 2021-02-07T23:42:59.000Z | 2022-03-31T11:14:14.000Z | tests/unit_tests/test_exchange_coinbase.py | joa-rodrigues/pycryptobot | 669f4a3c73eb0ac85f9e4261a093fd61c38ca7ab | [
"Apache-2.0"
] | 577 | 2020-12-17T17:13:40.000Z | 2022-03-31T07:04:52.000Z | import json
import pytest
import responses
import requests
import sys
import pandas
from models.exchange.ExchangesEnum import Exchange
sys.path.append('.')
# pylint: disable=import-error
from models.PyCryptoBot import PyCryptoBot
from models.exchange.coinbase_pro import AuthAPI, PublicAPI
app = PyCryptoBot(exchange=... | 32.653595 | 132 | 0.70036 | import json
import pytest
import responses
import requests
import sys
import pandas
from models.exchange.ExchangesEnum import Exchange
sys.path.append('.')
from models.PyCryptoBot import PyCryptoBot
from models.exchange.coinbase_pro import AuthAPI, PublicAPI
app = PyCryptoBot(exchange= Exchange.COINBASEPRO)
def te... | true | true |
f74d29149debcf1a0775297543cc5ed53ec37037 | 4,592 | py | Python | c2cgeoportal/tests/functional/test_shortener.py | craxxkid/c2cgeoportal | 60ca7d5d014d69b0a938f858271c911a30da77c3 | [
"BSD-2-Clause-FreeBSD"
] | null | null | null | c2cgeoportal/tests/functional/test_shortener.py | craxxkid/c2cgeoportal | 60ca7d5d014d69b0a938f858271c911a30da77c3 | [
"BSD-2-Clause-FreeBSD"
] | null | null | null | c2cgeoportal/tests/functional/test_shortener.py | craxxkid/c2cgeoportal | 60ca7d5d014d69b0a938f858271c911a30da77c3 | [
"BSD-2-Clause-FreeBSD"
] | null | null | null | # -*- coding: utf-8 -*-
# Copyright (c) 2013-2016, Camptocamp SA
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright notice, this
#... | 34.787879 | 81 | 0.660497 |
from unittest import TestCase
from nose.plugins.attrib import attr
from pyramid import testing
from c2cgeoportal.tests.functional import (
tear_down_common as tearDownModule, set_up_common as setUpModule
)
@attr(functional=True)
class TestshortenerView(TestCase):
def setUp(s... | true | true |
f74d2a9f31f4631925debf1f5c5086b3b13e7f88 | 4,153 | py | Python | python-cookie-cutter/lib/python_cookie_cutter/projectbuilder.py | sirmax666/python-cookie-cutter | 22f6dd50736dec59ec3266ff31c4d44a0787c14c | [
"MIT"
] | null | null | null | python-cookie-cutter/lib/python_cookie_cutter/projectbuilder.py | sirmax666/python-cookie-cutter | 22f6dd50736dec59ec3266ff31c4d44a0787c14c | [
"MIT"
] | null | null | null | python-cookie-cutter/lib/python_cookie_cutter/projectbuilder.py | sirmax666/python-cookie-cutter | 22f6dd50736dec59ec3266ff31c4d44a0787c14c | [
"MIT"
] | null | null | null | # -----------------------------------------------------------------------------
# Builder
# -----------------------------------------------------------------------------
# Team: DataHub
# -----------------------------------------------------------------------------
# Author: Maxime Sirois
# ----------------------... | 36.113043 | 80 | 0.554057 |
from jinja2 import Template
import logging
from pathlib import Path
import subprocess
from . import constants as C
from . import utils
logger = logging.getLogger(__name__)
class Builder:
def __init__(self, properties, parameters=None):
self.parameters = parameters
sel... | true | true |
f74d2adc2823f9d8a4ba4829012cc9b39cb3fbaa | 334 | py | Python | tests/python-gpu/test_gpu_demos.py | sanchitanand/xgboost | b3193052b31e3e984f0f3d9c2c67ae3c2e114f9b | [
"Apache-2.0"
] | 2 | 2020-12-28T06:19:42.000Z | 2021-11-20T04:36:08.000Z | tests/python-gpu/test_gpu_demos.py | sanchitanand/xgboost | b3193052b31e3e984f0f3d9c2c67ae3c2e114f9b | [
"Apache-2.0"
] | 1 | 2020-07-20T17:18:36.000Z | 2020-07-20T17:18:36.000Z | tests/python-gpu/test_gpu_demos.py | sanchitanand/xgboost | b3193052b31e3e984f0f3d9c2c67ae3c2e114f9b | [
"Apache-2.0"
] | 1 | 2019-07-21T03:12:42.000Z | 2019-07-21T03:12:42.000Z | import os
import subprocess
import sys
import pytest
sys.path.append("tests/python")
import testing as tm
import test_demos as td # noqa
@pytest.mark.skipif(**tm.no_cupy())
def test_data_iterator():
script = os.path.join(td.PYTHON_DEMO_DIR, 'data_iterator.py')
cmd = ['python', script]
subprocess.ch... | 23.857143 | 65 | 0.724551 | import os
import subprocess
import sys
import pytest
sys.path.append("tests/python")
import testing as tm
import test_demos as td
@pytest.mark.skipif(**tm.no_cupy())
def test_data_iterator():
script = os.path.join(td.PYTHON_DEMO_DIR, 'data_iterator.py')
cmd = ['python', script]
subprocess.check_ca... | true | true |
f74d2b99d70a70ac36210e105d7657a35800c6fb | 1,192 | py | Python | dmarc_metrics_exporter/tests/test_metrics_persister.py | Tristan971/dmarc-metrics-exporter | d666693786fdd75b95cf8f13738bf177e70d741b | [
"MIT"
] | 6 | 2021-09-17T20:15:30.000Z | 2022-02-26T18:14:17.000Z | dmarc_metrics_exporter/tests/test_metrics_persister.py | Tristan971/dmarc-metrics-exporter | d666693786fdd75b95cf8f13738bf177e70d741b | [
"MIT"
] | 14 | 2021-01-11T13:24:18.000Z | 2022-02-09T20:43:51.000Z | dmarc_metrics_exporter/tests/test_metrics_persister.py | fl42/dmarc-metrics-exporter | 59a5825016e0bdfeeefcb25d39c4a01218daf9d4 | [
"MIT"
] | 4 | 2021-09-20T14:53:49.000Z | 2021-12-17T18:49:45.000Z | from dmarc_metrics_exporter.dmarc_metrics import (
Disposition,
DmarcMetrics,
DmarcMetricsCollection,
Meta,
)
from dmarc_metrics_exporter.metrics_persister import MetricsPersister
def test_roundtrip_metrics(tmp_path):
metrics_db = tmp_path / "metrics.db"
metrics = DmarcMetricsCollection(
... | 29.8 | 75 | 0.627517 | from dmarc_metrics_exporter.dmarc_metrics import (
Disposition,
DmarcMetrics,
DmarcMetricsCollection,
Meta,
)
from dmarc_metrics_exporter.metrics_persister import MetricsPersister
def test_roundtrip_metrics(tmp_path):
metrics_db = tmp_path / "metrics.db"
metrics = DmarcMetricsCollection(
... | true | true |
f74d2cb20e1ea6030aaa7c62c38404d8a5b803a1 | 2,099 | py | Python | src/indra_cogex/sources/bgee/__init__.py | dianakolusheva/indra_cogex | d149c6d4b7ffa5fb939badcc61684e016666153b | [
"BSD-2-Clause"
] | 2 | 2021-05-27T02:44:09.000Z | 2022-01-12T21:34:07.000Z | src/indra_cogex/sources/bgee/__init__.py | dianakolusheva/indra_cogex | d149c6d4b7ffa5fb939badcc61684e016666153b | [
"BSD-2-Clause"
] | 33 | 2021-08-29T18:23:26.000Z | 2022-03-29T21:56:08.000Z | src/indra_cogex/sources/bgee/__init__.py | dianakolusheva/indra_cogex | d149c6d4b7ffa5fb939badcc61684e016666153b | [
"BSD-2-Clause"
] | 5 | 2021-06-15T09:01:23.000Z | 2022-03-13T14:26:09.000Z | # -*- coding: utf-8 -*-
"""Processor for Bgee."""
import os
import pickle
from pathlib import Path
from typing import Union
import pyobo
from indra_cogex.representation import Node, Relation
from indra_cogex.sources.processor import Processor
class BgeeProcessor(Processor):
"""Processor for Bgee."""
name... | 30.42029 | 104 | 0.580753 |
import os
import pickle
from pathlib import Path
from typing import Union
import pyobo
from indra_cogex.representation import Node, Relation
from indra_cogex.sources.processor import Processor
class BgeeProcessor(Processor):
name = "bgee"
node_types = ["BioEntity"]
def __init__(self, path: Union[No... | true | true |
f74d2ccd36714d8c8feb1fa3fdbdedb0c184a37b | 429 | py | Python | hstphot/read_ds9region.py | bkornpob/hstphot | eafaebc382450061690c5795ce350336801d8037 | [
"MIT"
] | null | null | null | hstphot/read_ds9region.py | bkornpob/hstphot | eafaebc382450061690c5795ce350336801d8037 | [
"MIT"
] | null | null | null | hstphot/read_ds9region.py | bkornpob/hstphot | eafaebc382450061690c5795ce350336801d8037 | [
"MIT"
] | null | null | null | import numpy as np
def read_ds9region(ds9regfile):
"""
Assume ds9regfile in the format as ds9, and coordinate system as image
"""
out = {}
f = open(ds9regfile,'r')
for i,ii in enumerate(f.readlines()):
if i < 3:
continue
x,y,_ = np.array(ii.split('(')[1].split(')')[0... | 26.8125 | 81 | 0.531469 | import numpy as np
def read_ds9region(ds9regfile):
out = {}
f = open(ds9regfile,'r')
for i,ii in enumerate(f.readlines()):
if i < 3:
continue
x,y,_ = np.array(ii.split('(')[1].split(')')[0].split(',')).astype(float)
z = ii.split('{')[1].split('}')[0]
out[z] = (x,... | true | true |
f74d2f9a511f3627930afd668bc222d2a2aa3261 | 2,587 | py | Python | app/core/models.py | ijhajj/recipe-app-api | dbce67aa89b0718e900ac0aa113197cde6b94b42 | [
"MIT"
] | null | null | null | app/core/models.py | ijhajj/recipe-app-api | dbce67aa89b0718e900ac0aa113197cde6b94b42 | [
"MIT"
] | null | null | null | app/core/models.py | ijhajj/recipe-app-api | dbce67aa89b0718e900ac0aa113197cde6b94b42 | [
"MIT"
] | null | null | null | import uuid
import os
from django.db import models
from django.contrib.auth.models import AbstractBaseUser, BaseUserManager, \
PermissionsMixin
from django.conf import settings
def recipe_image_file_path(instance, filename):
"""Generate file path for new recipe image"""
... | 28.744444 | 76 | 0.669115 | import uuid
import os
from django.db import models
from django.contrib.auth.models import AbstractBaseUser, BaseUserManager, \
PermissionsMixin
from django.conf import settings
def recipe_image_file_path(instance, filename):
ext = filename.split('.')[-1]
filename = f'{u... | true | true |
f74d31672bd7fcacc80c39737d4007abb3ffca90 | 11,674 | py | Python | config/settings/base.py | dhavalsavalia/techfest_management | 651b13277243b861f1c492d56122d32de2a7858a | [
"Apache-1.1"
] | 2 | 2019-02-22T18:59:58.000Z | 2021-09-21T16:14:46.000Z | config/settings/base.py | dhavalsavalia/techfest_management | 651b13277243b861f1c492d56122d32de2a7858a | [
"Apache-1.1"
] | null | null | null | config/settings/base.py | dhavalsavalia/techfest_management | 651b13277243b861f1c492d56122d32de2a7858a | [
"Apache-1.1"
] | null | null | null | """
Base settings to build other settings files upon.
"""
import environ
ROOT_DIR = environ.Path(__file__) - 3 # (techfest_management/config/settings/base.py - 3 = techfest_management/)
APPS_DIR = ROOT_DIR.path('techfest_management')
env = environ.Env()
READ_DOT_ENV_FILE = env.bool('DJANGO_READ_DOT_ENV_FILE', defa... | 41.992806 | 113 | 0.647165 |
import environ
ROOT_DIR = environ.Path(__file__) - 3
APPS_DIR = ROOT_DIR.path('techfest_management')
env = environ.Env()
READ_DOT_ENV_FILE = env.bool('DJANGO_READ_DOT_ENV_FILE', default=False)
if READ_DOT_ENV_FILE:
env.read_env(str(ROOT_DIR.path('.env')))
= env.bool('DJANGO_DEBUG', False)
TIME_ZO... | true | true |
f74d31c48ab23326ffe95c058bb72dde1546c508 | 114 | py | Python | todo/backend/todos/admin.py | XrossFox/DjangoForAPIsCodeExamples | e4d02533a2fba6dad24044816558f69f053b341c | [
"MIT"
] | null | null | null | todo/backend/todos/admin.py | XrossFox/DjangoForAPIsCodeExamples | e4d02533a2fba6dad24044816558f69f053b341c | [
"MIT"
] | 1 | 2018-11-20T13:55:12.000Z | 2018-11-20T13:55:12.000Z | todo/backend/todos/admin.py | hannody/todo-api-react | 89869f7c86a88634c989512cf346ed5ca1f46259 | [
"MIT"
] | null | null | null | from django.contrib import admin
# Register your models here.
from .models import Todo
admin.site.register(Todo)
| 19 | 32 | 0.798246 | from django.contrib import admin
from .models import Todo
admin.site.register(Todo)
| true | true |
f74d31d75ae2ba84ae77be864aed71356c28fe66 | 8,256 | py | Python | ttt/board.py | codacy-badger/nxn-tic-tac-toe | 15784200cb0ff067bbcc1e31171a458f12de276a | [
"MIT"
] | null | null | null | ttt/board.py | codacy-badger/nxn-tic-tac-toe | 15784200cb0ff067bbcc1e31171a458f12de276a | [
"MIT"
] | null | null | null | ttt/board.py | codacy-badger/nxn-tic-tac-toe | 15784200cb0ff067bbcc1e31171a458f12de276a | [
"MIT"
] | null | null | null | from typing import List, Dict
from ttt.helper_util import (PositionOccupiedException,
InvalidCellPosition, AllMovesExhausedWithNoWinner,
BgColors)
from ttt.player import Player
class Move(object):
"""
Class used to identify a move being selected by th... | 35.131915 | 86 | 0.58188 | from typing import List, Dict
from ttt.helper_util import (PositionOccupiedException,
InvalidCellPosition, AllMovesExhausedWithNoWinner,
BgColors)
from ttt.player import Player
class Move(object):
def __init__(self, position: int):
self._position... | true | true |
f74d32d1ef804916556b035fe66052485a4b75a8 | 33 | py | Python | runserver.py | kjnsn/mhvdb2 | ce3fc77f76ca32e2aaeff928b291cc45d041b68f | [
"MIT"
] | 2 | 2015-04-11T09:45:41.000Z | 2015-06-16T03:59:48.000Z | runserver.py | kjnsn/mhvdb2 | ce3fc77f76ca32e2aaeff928b291cc45d041b68f | [
"MIT"
] | 32 | 2015-01-27T05:39:41.000Z | 2019-11-10T09:57:27.000Z | runserver.py | kjnsn/mhvdb2 | ce3fc77f76ca32e2aaeff928b291cc45d041b68f | [
"MIT"
] | 2 | 2015-04-11T09:38:46.000Z | 2015-04-14T08:01:49.000Z | from mhvdb2 import app
app.run()
| 11 | 22 | 0.757576 | from mhvdb2 import app
app.run()
| true | true |
f74d32e9405d5223643140109d54267e60d58480 | 6,850 | py | Python | examples/dmri_dtk_dti.py | FredLoney/nipype | ceaa28dcbfe29ca4373479c897da9fc958167ccd | [
"BSD-3-Clause"
] | 1 | 2018-09-09T14:47:04.000Z | 2018-09-09T14:47:04.000Z | examples/dmri_dtk_dti.py | MarcCote/nipype | b4014e1d87509f35242f0547f51d2b8962f83cbe | [
"BSD-3-Clause"
] | null | null | null | examples/dmri_dtk_dti.py | MarcCote/nipype | b4014e1d87509f35242f0547f51d2b8962f83cbe | [
"BSD-3-Clause"
] | 1 | 2020-02-19T13:47:05.000Z | 2020-02-19T13:47:05.000Z | #!/usr/bin/env python
"""
==================================
dMRI: DTI - Diffusion Toolkit, FSL
==================================
A pipeline example that uses several interfaces to perform analysis on
diffusion weighted images using Diffusion Toolkit tools.
This tutorial is based on the 2010 FSL course and uses data... | 31.422018 | 97 | 0.661606 |
import nipype.interfaces.io as nio
import nipype.interfaces.fsl as fsl
import nipype.interfaces.diffusion_toolkit as dtk
import nipype.interfaces.utility as util
import nipype.pipeline.engine as pe
import os
from nipype.workflows.dmri.fsl.dti imp... | true | true |
f74d33791ddbc5adc0909b31a58953af26d1307d | 5,067 | py | Python | streamlit_app/streamlit_app.py | gerardrbentley/peak-weather | 2880184c99c2d30075665f76a9e8b815906a55e5 | [
"Apache-2.0"
] | null | null | null | streamlit_app/streamlit_app.py | gerardrbentley/peak-weather | 2880184c99c2d30075665f76a9e8b815906a55e5 | [
"Apache-2.0"
] | null | null | null | streamlit_app/streamlit_app.py | gerardrbentley/peak-weather | 2880184c99c2d30075665f76a9e8b815906a55e5 | [
"Apache-2.0"
] | null | null | null | from copy import deepcopy
import asyncio
import json
import pandas as pd
import streamlit as st
from structlog import get_logger
from helpers import (
fromtimestamp,
show_weather,
WeatherItem,
gather_one_call_weather_data,
clean_time,
)
log = get_logger()
st.set_page_config(
layout="wide",
... | 33.117647 | 109 | 0.612197 | from copy import deepcopy
import asyncio
import json
import pandas as pd
import streamlit as st
from structlog import get_logger
from helpers import (
fromtimestamp,
show_weather,
WeatherItem,
gather_one_call_weather_data,
clean_time,
)
log = get_logger()
st.set_page_config(
layout="wide",
... | true | true |
f74d340365398ccec15f787f0ea1692c1384e107 | 16,004 | py | Python | datadog_automon.py | looprock/automon | 333d8b28843e687d499ea00d1bf4c6f2b6334b59 | [
"Apache-2.0"
] | null | null | null | datadog_automon.py | looprock/automon | 333d8b28843e687d499ea00d1bf4c6f2b6334b59 | [
"Apache-2.0"
] | null | null | null | datadog_automon.py | looprock/automon | 333d8b28843e687d499ea00d1bf4c6f2b6334b59 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
import argparse
import logging
import sys
import os
import re
import yaml
from jinja2 import Template, Environment, FileSystemLoader
# Goals:
# k8s_container_cpu_exceeding_request: CPU exceeds request over 10 minutes - if cpu request configured
# k8s_container_memory_exceeding_request: Memory exc... | 42.338624 | 218 | 0.663147 |
import argparse
import logging
import sys
import os
import re
import yaml
from jinja2 import Template, Environment, FileSystemLoader
on.get('DEBUG', None)
if debug:
logging.basicConfig(stream=sys.stdout, level=logging.DEBUG)
else:
logging.basicConfig(stream=sys.stdout, level=logging.INFO)
if os.p... | true | true |
f74d3431a049864969eafcbd08bb28da4ee82a26 | 6,205 | py | Python | simulation/acc_idmplus.py | ErwindeGelder/ScenarioRiskQuantification | ee351b7bd3629af0c1d1d800dcc5ac5426b9b804 | [
"MIT"
] | 4 | 2021-06-28T07:33:27.000Z | 2022-02-20T09:26:41.000Z | simulation/acc_idmplus.py | ErwindeGelder/ScenarioRiskQuantification | ee351b7bd3629af0c1d1d800dcc5ac5426b9b804 | [
"MIT"
] | null | null | null | simulation/acc_idmplus.py | ErwindeGelder/ScenarioRiskQuantification | ee351b7bd3629af0c1d1d800dcc5ac5426b9b804 | [
"MIT"
] | null | null | null | """ Model of ACC with FCW and IDM+ to take over from Xiao et al. (2017).
Creation date: 2020 08 12
Author(s): Erwin de Gelder
Modifications:
"""
import numpy as np
from .acc import ACC, ACCParameters, ACCState
from .idm import IDMParameters
from .idmplus import IDMPlus
class ACCIDMPlusParameters(ACCParameters):
... | 43.090278 | 100 | 0.654956 |
import numpy as np
from .acc import ACC, ACCParameters, ACCState
from .idm import IDMParameters
from .idmplus import IDMPlus
class ACCIDMPlusParameters(ACCParameters):
fcw_threshold: float = 0.75
fcw_delay: float = 1.0
driver_takeover_speed: float = 15.0
driver_takeover_view: float = 150
... | true | true |
f74d3584214912f584b1e49a3447c52fd2c46b3b | 32,861 | py | Python | addons/odoo/addons/stock/models/stock_rule.py | apadanagroup/parOdoo | 8c6f67848e0689b76fb780feca08d819fd3c1847 | [
"Apache-2.0"
] | 12 | 2021-03-26T08:39:40.000Z | 2022-03-16T02:20:10.000Z | addons/odoo/addons/stock/models/stock_rule.py | apadanagroup/parOdoo | 8c6f67848e0689b76fb780feca08d819fd3c1847 | [
"Apache-2.0"
] | 13 | 2020-12-20T16:00:21.000Z | 2022-03-14T14:55:30.000Z | addons/odoo/addons/stock/models/stock_rule.py | apadanagroup/parOdoo | 8c6f67848e0689b76fb780feca08d819fd3c1847 | [
"Apache-2.0"
] | 17 | 2020-08-31T11:18:49.000Z | 2022-02-09T05:57:31.000Z | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from collections import namedtuple, OrderedDict, defaultdict
from dateutil.relativedelta import relativedelta
from odoo.tools.misc import split_every
from psycopg2 import OperationalError
from odoo import api, fields, m... | 52.160317 | 184 | 0.629835 |
from collections import namedtuple, OrderedDict, defaultdict
from dateutil.relativedelta import relativedelta
from odoo.tools.misc import split_every
from psycopg2 import OperationalError
from odoo import api, fields, models, registry, SUPERUSER_ID, _
from odoo.osv import expression
from odoo.tools import DEFAULT_S... | true | true |
f74d3719939013bef66b6d791bc59048a670c2fc | 146 | py | Python | Projeto Django/contato/apps.py | yurimses/tp-cruzi-db | 201c114b70c7dc3b7eaf549d1778689567499e22 | [
"MIT"
] | 1 | 2021-03-26T18:21:59.000Z | 2021-03-26T18:21:59.000Z | Projeto Django/contato/apps.py | yurimses/tp-cruzi-db | 201c114b70c7dc3b7eaf549d1778689567499e22 | [
"MIT"
] | 14 | 2021-03-26T20:54:22.000Z | 2021-04-06T17:18:53.000Z | Projeto Django/contato/apps.py | yurimses/tp-cruzi-db | 201c114b70c7dc3b7eaf549d1778689567499e22 | [
"MIT"
] | 2 | 2021-04-01T23:43:20.000Z | 2021-04-27T13:35:28.000Z | from django.apps import AppConfig
class ContatoConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'contato'
| 20.857143 | 56 | 0.760274 | from django.apps import AppConfig
class ContatoConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'contato'
| true | true |
f74d376556e1a4481299787149e535d6ac958aae | 5,125 | py | Python | pinn/models/base.py | yqshao/PiNN | a0ab812acfd799e4da0f4b283e63ea2f559c4151 | [
"BSD-3-Clause"
] | 3 | 2019-10-11T02:31:16.000Z | 2022-03-12T04:48:48.000Z | pinn/models/base.py | yqshao/pinn | 464034dda44ce053cf1255a3e7d367c636d6b9f3 | [
"BSD-3-Clause"
] | null | null | null | pinn/models/base.py | yqshao/pinn | 464034dda44ce053cf1255a3e7d367c636d6b9f3 | [
"BSD-3-Clause"
] | 1 | 2021-07-02T19:31:01.000Z | 2021-07-02T19:31:01.000Z | # -*- coding: utf-8 -*-
"""Basic functions for PiNN models"""
import tensorflow as tf
from pinn.utils import pi_named
def export_model(model_fn):
# default parameters for all models
from pinn.optimizers import default_adam
default_params = {'optimizer': default_adam}
def pinn_model(params, **kwargs):
... | 43.432203 | 110 | 0.59922 |
import tensorflow as tf
from pinn.utils import pi_named
def export_model(model_fn):
from pinn.optimizers import default_adam
default_params = {'optimizer': default_adam}
def pinn_model(params, **kwargs):
model_dir = params['model_dir']
params_tmp = default_params.copy()
params... | true | true |
f74d37b31148b688616cf054a7531d0d598930a2 | 553 | py | Python | Python_ABC/2-12excel/4updateProduce.py | Chandler-Song/Python_Awesome | a44b8b79de7b429a00ac5798e7ecdc26c79a09ed | [
"MIT"
] | null | null | null | Python_ABC/2-12excel/4updateProduce.py | Chandler-Song/Python_Awesome | a44b8b79de7b429a00ac5798e7ecdc26c79a09ed | [
"MIT"
] | null | null | null | Python_ABC/2-12excel/4updateProduce.py | Chandler-Song/Python_Awesome | a44b8b79de7b429a00ac5798e7ecdc26c79a09ed | [
"MIT"
] | null | null | null | # Corret cost in produceSale spreadsheet
import openpyxl
# The product types and their updated prices
PRICE_UPDATE = {
'Garlic': 3.17,
'Celery':1.19,
'Lemon': 1.27
}
wb = openpyxl.load_workbook('produceSales.xlsx')
ws = wb.get_sheet_by_name('Sheet')
# loop through the rows and update the prices, skip the fi... | 25.136364 | 65 | 0.737794 |
import openpyxl
PRICE_UPDATE = {
'Garlic': 3.17,
'Celery':1.19,
'Lemon': 1.27
}
wb = openpyxl.load_workbook('produceSales.xlsx')
ws = wb.get_sheet_by_name('Sheet')
for rowNum in range(2, ws.max_row+1):
productName = ws.cell(row=rowNum, column=1).value
if productName in PRICE_UPDATE:
ws.cell(row=row... | true | true |
f74d38be5f92a764f9105c28efe0d3c0263e2c28 | 9,601 | py | Python | Packs/Cybereason/Integrations/Cybereason/Cybereason_test.py | ddi-danielsantander/content | 67e2edc404f50c332d928dbdbce00a447bb5532f | [
"MIT"
] | 1 | 2020-04-19T11:05:42.000Z | 2020-04-19T11:05:42.000Z | Packs/Cybereason/Integrations/Cybereason/Cybereason_test.py | ddi-danielsantander/content | 67e2edc404f50c332d928dbdbce00a447bb5532f | [
"MIT"
] | 9 | 2021-02-08T20:51:18.000Z | 2021-09-23T23:27:38.000Z | Packs/Cybereason/Integrations/Cybereason/Cybereason_test.py | ddi-danielsantander/content | 67e2edc404f50c332d928dbdbce00a447bb5532f | [
"MIT"
] | 2 | 2020-10-11T18:01:32.000Z | 2020-10-14T03:21:23.000Z | import demistomock as demisto
""" API RAW RESULTS """
MACHINE_OUTPUTS = {
"status": "SUCCESS",
"message": "",
"data": {
"evidenceMap": {
"reportedByAntiMalwareEvidence": 1
},
"resultIdToElementDataMap": {
"-1879720569.-2277552225461983666": {
... | 36.505703 | 130 | 0.373399 | import demistomock as demisto
MACHINE_OUTPUTS = {
"status": "SUCCESS",
"message": "",
"data": {
"evidenceMap": {
"reportedByAntiMalwareEvidence": 1
},
"resultIdToElementDataMap": {
"-1879720569.-2277552225461983666": {
"isMalicious": 'false'... | true | true |
f74d38e5765d811c6e031d0e84273a595a6ace74 | 7,114 | py | Python | glimslib/simulation_helpers/test_unit_timeSeriesMultiData.py | danielabler/glimslib | 3d345bf3ed2d364e83a00ad9297dd5f81d7193db | [
"MIT"
] | null | null | null | glimslib/simulation_helpers/test_unit_timeSeriesMultiData.py | danielabler/glimslib | 3d345bf3ed2d364e83a00ad9297dd5f81d7193db | [
"MIT"
] | 5 | 2019-01-05T01:38:05.000Z | 2019-06-03T16:49:27.000Z | glimslib/simulation_helpers/test_unit_timeSeriesMultiData.py | danielabler/glimslib | 3d345bf3ed2d364e83a00ad9297dd5f81d7193db | [
"MIT"
] | 3 | 2019-12-28T16:01:48.000Z | 2022-01-20T08:44:01.000Z | from unittest import TestCase
import os
import numpy as np
import glimslib.utils.file_utils as fu
from glimslib import fenics_local as fenics, config
from glimslib.simulation_helpers.helper_classes import FunctionSpace, TimeSeriesMultiData
class TestTimeSeriesMultiData(TestCase):
def setUp(self):
# Doma... | 56.460317 | 112 | 0.702277 | from unittest import TestCase
import os
import numpy as np
import glimslib.utils.file_utils as fu
from glimslib import fenics_local as fenics, config
from glimslib.simulation_helpers.helper_classes import FunctionSpace, TimeSeriesMultiData
class TestTimeSeriesMultiData(TestCase):
def setUp(self):
... | true | true |
f74d39490a295f86abcf8a65d2eac67cd6edc176 | 3,849 | py | Python | devscripts/create-github-release.py | galgamerslee/youtobedl | 7b0d1c28597bd38567e5b4e853f669a5a601c6e8 | [
"Unlicense"
] | 10 | 2020-05-29T03:20:03.000Z | 2022-03-29T01:05:20.000Z | devscripts/create-github-release.py | huyangfeng/youtobedl | 7b0d1c28597bd38567e5b4e853f669a5a601c6e8 | [
"Unlicense"
] | null | null | null | devscripts/create-github-release.py | huyangfeng/youtobedl | 7b0d1c28597bd38567e5b4e853f669a5a601c6e8 | [
"Unlicense"
] | 9 | 2020-05-29T03:21:02.000Z | 2021-04-14T03:26:05.000Z | #!/usr/bin/env python
from __future__ import unicode_literals
import base64
import json
import mimetypes
import netrc
import optparse
import os
import sys
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from youtube_dl.compat import (
compat_basestring,
compat_input,
compa... | 34.061947 | 95 | 0.646402 |
from __future__ import unicode_literals
import base64
import json
import mimetypes
import netrc
import optparse
import os
import sys
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from youtube_dl.compat import (
compat_basestring,
compat_input,
compat_getpass,
compat... | true | true |
f74d3a7e76e56b7f23c11637771b91bb4921a56b | 1,372 | py | Python | tools/nmeatk.py | dakk/nmeatoolkit | 6378d2aa6937732e8ad1c47ce7a9ad0f629f5351 | [
"MIT"
] | null | null | null | tools/nmeatk.py | dakk/nmeatoolkit | 6378d2aa6937732e8ad1c47ce7a9ad0f629f5351 | [
"MIT"
] | null | null | null | tools/nmeatk.py | dakk/nmeatoolkit | 6378d2aa6937732e8ad1c47ce7a9ad0f629f5351 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# Copyright (C) 2021 Davide Gessa
'''
MIT License
Copyright (c) 2021 Davide Gessa
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 li... | 37.081081 | 78 | 0.774781 |
from nmeatoolkit.args import getDefaultParser, processArguments
def main():
parser = getDefaultParser()
args = parser.parse_args()
pipeline = processArguments(args)
pipeline.run()
if __name__ == "__main__":
main() | true | true |
f74d3cd274286ba754528a104b66bb2d95b8bb53 | 2,782 | py | Python | stdimage/utils.py | timomeara/django-stdimage | c8635440cfd7209b86a321075f66e3b881450073 | [
"MIT"
] | null | null | null | stdimage/utils.py | timomeara/django-stdimage | c8635440cfd7209b86a321075f66e3b881450073 | [
"MIT"
] | null | null | null | stdimage/utils.py | timomeara/django-stdimage | c8635440cfd7209b86a321075f66e3b881450073 | [
"MIT"
] | null | null | null | import os
import uuid
from django.core.files.storage import default_storage
from django.utils.text import slugify
from .models import StdImageField, StdImageFieldFile
class UploadTo:
file_pattern = "%(name)s%(ext)s"
path_pattern = "%(path)s"
def __call__(self, instance, filename):
path, ext = o... | 29.284211 | 77 | 0.643781 | import os
import uuid
from django.core.files.storage import default_storage
from django.utils.text import slugify
from .models import StdImageField, StdImageFieldFile
class UploadTo:
file_pattern = "%(name)s%(ext)s"
path_pattern = "%(path)s"
def __call__(self, instance, filename):
path, ext = o... | true | true |
f74d3cd803994be5b0ec6f093a396dab53fd0640 | 2,594 | py | Python | f_d_c.py | ashu2004a/face_recognition | a0585d81daa7f0588e6269df8e26fdf7f18c27be | [
"CC0-1.0"
] | 1 | 2021-04-25T14:48:23.000Z | 2021-04-25T14:48:23.000Z | f_d_c.py | ashu2004a/face_recognition | a0585d81daa7f0588e6269df8e26fdf7f18c27be | [
"CC0-1.0"
] | null | null | null | f_d_c.py | ashu2004a/face_recognition | a0585d81daa7f0588e6269df8e26fdf7f18c27be | [
"CC0-1.0"
] | null | null | null | '''
Author: Ashutosh Panigrahi
Year: 2021
Version: 0.0.1
'''
#This piece of code detect the face (image in png/jpg or else given) given.
import __future__
import click
import os
import re
import face_recognition.api as fcrec
import multiprocessing
import sys
import itertools
def print_result(filename, location):
... | 32.835443 | 137 | 0.712799 |
import __future__
import click
import os
import re
import face_recognition.api as fcrec
import multiprocessing
import sys
import itertools
def print_result(filename, location):
top, right, bottom, left = location
print("{},{},{},{},{}".format(filename, top, right, bottom, left))
def test_image(image_to_c... | true | true |
f74d3d5926733b49680eded0a7b2cfa1bfb34423 | 8,526 | py | Python | app/source/dragen/src/scheduler/aws_utils.py | siyervervetx/quickstart-illumina-dragen | 1543b3c6615ab825e5d79a97c6de47340500173f | [
"Apache-2.0"
] | 23 | 2018-10-04T06:56:26.000Z | 2021-10-30T16:47:30.000Z | app/source/dragen/src/scheduler/aws_utils.py | siyervervetx/quickstart-illumina-dragen | 1543b3c6615ab825e5d79a97c6de47340500173f | [
"Apache-2.0"
] | 23 | 2019-06-21T17:20:00.000Z | 2022-03-22T02:55:18.000Z | app/source/dragen/src/scheduler/aws_utils.py | siyervervetx/quickstart-illumina-dragen | 1543b3c6615ab825e5d79a97c6de47340500173f | [
"Apache-2.0"
] | 22 | 2018-10-04T10:12:09.000Z | 2022-02-21T19:56:09.000Z | #!/opt/workflow/bin/python2.7
#
# Copyright 2013-2016 Edico Genome Corporation. All rights reserved.
#
# This file contains confidential and proprietary information of the Edico Genome
# Corporation and is protected under the U.S. and international copyright and other
# intellectual property laws.
#
# $Id$
# $Author$
#... | 37.394737 | 116 | 0.641332 |
from __future__ import absolute_import
from __future__ import division
from builtins import map
from builtins import str
from past.utils import old_div
import os
from glob import glob
from multiprocessing import Pool
import boto3
from boto3.s3.transfer import S3Transfer
from boto3.s3.transfer import T... | true | true |
f74d3db1aefdd7054183593fbcd1cc842e9b0840 | 3,264 | py | Python | model/a2c.py | linthieda/DeepFEH | 273b5c695674e0d22bc7f701a5d64113034b04de | [
"MIT"
] | 4 | 2018-03-30T13:10:07.000Z | 2018-10-25T10:36:04.000Z | model/a2c.py | gen-ko/DeepFEH | 273b5c695674e0d22bc7f701a5d64113034b04de | [
"MIT"
] | null | null | null | model/a2c.py | gen-ko/DeepFEH | 273b5c695674e0d22bc7f701a5d64113034b04de | [
"MIT"
] | 1 | 2018-04-07T01:59:53.000Z | 2018-04-07T01:59:53.000Z | import numpy as np
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from reinforce import Reinforce
from model import CriticNet
import feh_simulator.simulator as gym
class A2C(Reinforce):
# Implementation of N-step Advantage Actor Critic.
# This class inherits the Reinforce class, so ... | 34 | 139 | 0.522059 | import numpy as np
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from reinforce import Reinforce
from model import CriticNet
import feh_simulator.simulator as gym
class A2C(Reinforce):
def __init__(self, env, lr, critic_lr, gamma, n, policy_path, critic_path, load=False... | true | true |
f74d3dcc1db2807336090cb9d59b2b338bc2bb5f | 818 | py | Python | yabgp/message/attribute/nlri/labeled_unicast/ipv4.py | mengjunyi/yabgp | 45b050b401851b2ea94a6a70de124c02487ca677 | [
"Apache-2.0"
] | 203 | 2015-05-15T12:07:30.000Z | 2022-03-13T16:36:03.000Z | yabgp/message/attribute/nlri/labeled_unicast/ipv4.py | mengjunyi/yabgp | 45b050b401851b2ea94a6a70de124c02487ca677 | [
"Apache-2.0"
] | 109 | 2015-05-19T16:07:59.000Z | 2022-03-09T08:18:23.000Z | yabgp/message/attribute/nlri/labeled_unicast/ipv4.py | mengjunyi/yabgp | 45b050b401851b2ea94a6a70de124c02487ca677 | [
"Apache-2.0"
] | 74 | 2015-05-14T15:24:10.000Z | 2022-03-09T06:21:51.000Z | # Copyright 2015-2016 Cisco Systems, Inc.
# All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... | 35.565217 | 78 | 0.749389 |
from yabgp.message.attribute.nlri.labeled_unicast import LabeledUnicast
from yabgp.common.afn import AFNUM_INET
class IPv4LabeledUnicast(LabeledUnicast):
AFI = AFNUM_INET
| true | true |
f74d3ddbe1705289ad1af2d86669e367bf327f07 | 1,501 | py | Python | tf_mnf/flows/rnvp.py | janosh/mnf-bnn | c192d9ed89a1cd8117233d2aba9ceea4f67ff863 | [
"MIT"
] | 2 | 2020-04-15T09:10:17.000Z | 2020-06-03T12:44:49.000Z | tf_mnf/flows/rnvp.py | janosh/tf-mnf | 955b083027d8757716e1cdb6baaf908964546e6d | [
"MIT"
] | null | null | null | tf_mnf/flows/rnvp.py | janosh/tf-mnf | 955b083027d8757716e1cdb6baaf908964546e6d | [
"MIT"
] | null | null | null | import tensorflow as tf
class RNVP(tf.Module):
"""Affine half (aka Real Non-Volume Preserving) flow (x = z * exp(s) + t),
where a randomly selected half z1 of the dimensions in z are transformed as an
affine function of the other half z2, i.e. scaled by s(z2) and shifted by t(z2).
From "Density estim... | 39.5 | 87 | 0.614257 | import tensorflow as tf
class RNVP(tf.Module):
def __init__(self, dim, h_sizes=[30], activation="tanh", **kwargs):
super().__init__(**kwargs)
layers = [tf.keras.layers.Dense(hs, activation) for hs in h_sizes]
self.net = tf.keras.Sequential(layers)
self.t = tf.keras.layers.Dense(di... | true | true |
f74d3e09d57430042b406790f16377b11423435d | 634 | py | Python | train/faci_training.py | Dung-Han-Lee/Pointcloud-based-Row-Detection-using-ShellNet-and-PyTorch | 9b57969cf05818839a7ecce37163752e3fddec5e | [
"MIT"
] | 8 | 2020-08-07T20:15:31.000Z | 2021-11-16T02:23:37.000Z | train/faci_training.py | Dung-Han-Lee/Pointcloud-based-Row-Detection-using-ShellNet-and-PyTorch | 9b57969cf05818839a7ecce37163752e3fddec5e | [
"MIT"
] | null | null | null | train/faci_training.py | Dung-Han-Lee/Pointcloud-based-Row-Detection-using-ShellNet-and-PyTorch | 9b57969cf05818839a7ecce37163752e3fddec5e | [
"MIT"
] | 4 | 2020-08-21T06:17:01.000Z | 2021-11-24T07:45:20.000Z | from glob import glob
import config
import errno
import os
def unique_id(msg):
ext = '.txt'
f = glob("*"+ext)[0]
num_trail = int(f.split(".")[0])
newf = "./" + str(num_trail+1) + ext
os.rename(f, newf)
outdir = os.path.join("../weights", config.summary_prefix+"%02d"%num_trail)
mkdir_p(outdi... | 22.642857 | 79 | 0.561514 | from glob import glob
import config
import errno
import os
def unique_id(msg):
ext = '.txt'
f = glob("*"+ext)[0]
num_trail = int(f.split(".")[0])
newf = "./" + str(num_trail+1) + ext
os.rename(f, newf)
outdir = os.path.join("../weights", config.summary_prefix+"%02d"%num_trail)
mkdir_p(outdi... | true | true |
f74d3e384e4739d74623ed39511172cecf32158b | 6,535 | py | Python | wals3/datatables.py | maggie-jiayizhang/wals3 | fa8f9a9cf968920f16859a075a08502988c9ec4d | [
"Apache-2.0"
] | 86 | 2015-03-18T07:47:54.000Z | 2022-03-27T10:16:01.000Z | wals3/datatables.py | maggie-jiayizhang/wals3 | fa8f9a9cf968920f16859a075a08502988c9ec4d | [
"Apache-2.0"
] | 21 | 2015-01-15T14:13:06.000Z | 2021-11-24T11:17:59.000Z | wals3/datatables.py | maggie-jiayizhang/wals3 | fa8f9a9cf968920f16859a075a08502988c9ec4d | [
"Apache-2.0"
] | 16 | 2015-02-13T05:31:11.000Z | 2022-03-03T08:54:37.000Z | from sqlalchemy.orm import joinedload, contains_eager, subqueryload
from clld.web import datatables
from clld.web.datatables.base import Col, LinkCol, DetailsRowLinkCol, IdCol
from clld.web.datatables.value import ValueNameCol
from clld.db.meta import DBSession
from clld.db.models import common
from clld.db.util impor... | 32.351485 | 89 | 0.639939 | from sqlalchemy.orm import joinedload, contains_eager, subqueryload
from clld.web import datatables
from clld.web.datatables.base import Col, LinkCol, DetailsRowLinkCol, IdCol
from clld.web.datatables.value import ValueNameCol
from clld.db.meta import DBSession
from clld.db.models import common
from clld.db.util impor... | true | true |
f74d3ee5bec9892194baef78681876d2be2a85ca | 3,875 | py | Python | .venv/lib/python3.8/site-packages/vectorbt/base/__init__.py | eo1989/VectorBTanalysis | bea3deaf2ee3fc114b308146f2af3e4f35f70197 | [
"MIT"
] | null | null | null | .venv/lib/python3.8/site-packages/vectorbt/base/__init__.py | eo1989/VectorBTanalysis | bea3deaf2ee3fc114b308146f2af3e4f35f70197 | [
"MIT"
] | null | null | null | .venv/lib/python3.8/site-packages/vectorbt/base/__init__.py | eo1989/VectorBTanalysis | bea3deaf2ee3fc114b308146f2af3e4f35f70197 | [
"MIT"
] | null | null | null | """Modules with base classes and utilities for pandas objects, such as broadcasting.
## Array wrapper
vectorbt's functionality is based upon the ability to perform the most essential pandas operations
using NumPy+Numba stack. One has to convert the Series/DataFrame into the NumPy format, perform
the computation, and ... | 34.598214 | 100 | 0.747097 | true | true | |
f74d3f266877284fa47c089847dda82f8b54f95a | 90 | py | Python | ding/model/wrapper/__init__.py | sailxjx/DI-engine | c6763f8e2ba885a2a02f611195a1b5f8b50bff00 | [
"Apache-2.0"
] | 464 | 2021-07-08T07:26:33.000Z | 2022-03-31T12:35:16.000Z | ding/model/wrapper/__init__.py | sailxjx/DI-engine | c6763f8e2ba885a2a02f611195a1b5f8b50bff00 | [
"Apache-2.0"
] | 177 | 2021-07-09T08:22:55.000Z | 2022-03-31T07:35:22.000Z | ding/model/wrapper/__init__.py | sailxjx/DI-engine | c6763f8e2ba885a2a02f611195a1b5f8b50bff00 | [
"Apache-2.0"
] | 92 | 2021-07-08T12:16:37.000Z | 2022-03-31T09:24:41.000Z | from .model_wrappers import model_wrap, register_wrapper, IModelWrapper, BaseModelWrapper
| 45 | 89 | 0.877778 | from .model_wrappers import model_wrap, register_wrapper, IModelWrapper, BaseModelWrapper
| true | true |
f74d3f6e2aa9639dc6e8376d56c37da0ae6fe0e3 | 13,531 | py | Python | src/visualization/plot_thesis.py | masasin/spirit | c8366e649eb105a8a579fb7a47dcc5aaeae6a0d8 | [
"MIT"
] | null | null | null | src/visualization/plot_thesis.py | masasin/spirit | c8366e649eb105a8a579fb7a47dcc5aaeae6a0d8 | [
"MIT"
] | 10 | 2017-03-28T12:11:45.000Z | 2017-03-31T05:44:00.000Z | src/visualization/plot_thesis.py | masasin/spirit | c8366e649eb105a8a579fb7a47dcc5aaeae6a0d8 | [
"MIT"
] | 1 | 2018-06-29T08:19:20.000Z | 2018-06-29T08:19:20.000Z | from functools import partial
from pathlib import Path
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn.apionly as sns
from ..analysis.csv_analysis import analyze_data, load_surveys
from ..data.survey_utils import ExperimentType
from .latexify import latexify, figure, fig_size
fro... | 42.955556 | 80 | 0.559899 | from functools import partial
from pathlib import Path
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn.apionly as sns
from ..analysis.csv_analysis import analyze_data, load_surveys
from ..data.survey_utils import ExperimentType
from .latexify import latexify, figure, fig_size
fro... | true | true |
f74d3f7cd3869a4dfa7052de0457be1739286c27 | 934 | py | Python | python/ex069_estatisticas2.py | lucasdiogomartins/curso-em-video | 9da92b6255a11021f719a9e0ce994db639e1ac38 | [
"MIT"
] | null | null | null | python/ex069_estatisticas2.py | lucasdiogomartins/curso-em-video | 9da92b6255a11021f719a9e0ce994db639e1ac38 | [
"MIT"
] | null | null | null | python/ex069_estatisticas2.py | lucasdiogomartins/curso-em-video | 9da92b6255a11021f719a9e0ce994db639e1ac38 | [
"MIT"
] | null | null | null | mai_idade = homens = fem_men_20 = 0
while True:
print('-'*30)
print('CADASTRE UMA PESSOA')
# inserir dados
idade = int(input('Idade: '))
sexo = input('Sexo [M/F]: ').strip().upper()[0]
while sexo not in 'MF':
sexo = input('ERRO. Digite novamente o sexo: ').strip().upper()[0]
# veri... | 31.133333 | 77 | 0.601713 | mai_idade = homens = fem_men_20 = 0
while True:
print('-'*30)
print('CADASTRE UMA PESSOA')
idade = int(input('Idade: '))
sexo = input('Sexo [M/F]: ').strip().upper()[0]
while sexo not in 'MF':
sexo = input('ERRO. Digite novamente o sexo: ').strip().upper()[0]
if idade >= 18:
... | true | true |
f74d3fdef48d3fa575404a4e4f34307169cfdbc1 | 3,132 | py | Python | qa/rpc-tests/bipdersig.py | mirzaei-ce/core-civilbit | cab3e53bdc6b04a84f4bc48114efc07865be814a | [
"MIT"
] | null | null | null | qa/rpc-tests/bipdersig.py | mirzaei-ce/core-civilbit | cab3e53bdc6b04a84f4bc48114efc07865be814a | [
"MIT"
] | null | null | null | qa/rpc-tests/bipdersig.py | mirzaei-ce/core-civilbit | cab3e53bdc6b04a84f4bc48114efc07865be814a | [
"MIT"
] | null | null | null | #!/usr/bin/env python2
# Copyright (c) 2014-2015 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Test the BIP66 changeover logic
#
from test_framework.test_framework import CivilbitTestFramework
fr... | 35.590909 | 98 | 0.622605 |
from test_framework.test_framework import CivilbitTestFramework
from test_framework.util import *
class BIP66Test(CivilbitTestFramework):
def setup_network(self):
self.nodes = []
self.nodes.append(start_node(0, self.options.tmpdir, []))
self.nodes.append(start_node(1, self.options... | true | true |
f74d3ff3f58d2256abb70825002355c26c1ff6b1 | 1,704 | py | Python | ultisnips/test/test_AnonymousExpansion.py | adrewasa/asavim | 679db0656d35d4cc0b00b8407d5834ff5f3e8765 | [
"Apache-2.0"
] | 28 | 2018-05-11T18:36:45.000Z | 2021-05-16T00:16:18.000Z | ultisnips/test/test_AnonymousExpansion.py | adrewasa/asavim | 679db0656d35d4cc0b00b8407d5834ff5f3e8765 | [
"Apache-2.0"
] | null | null | null | ultisnips/test/test_AnonymousExpansion.py | adrewasa/asavim | 679db0656d35d4cc0b00b8407d5834ff5f3e8765 | [
"Apache-2.0"
] | 13 | 2018-07-20T02:45:35.000Z | 2020-09-01T07:07:53.000Z | from test.vim_test_case import VimTestCase as _VimTest
from test.constant import *
# Anonymous Expansion {{{#
class _AnonBase(_VimTest):
args = ''
def _extra_vim_config(self, vim_config):
vim_config.append('inoremap <silent> %s <C-R>=UltiSnips#Anon(%s)<cr>'
% (EA, self.arg... | 25.058824 | 77 | 0.614437 | from test.vim_test_case import VimTestCase as _VimTest
from test.constant import *
class _AnonBase(_VimTest):
args = ''
def _extra_vim_config(self, vim_config):
vim_config.append('inoremap <silent> %s <C-R>=UltiSnips#Anon(%s)<cr>'
% (EA, self.args))
class Anon_NoTrigger_S... | true | true |
f74d4001312a35bfae688883037bffa18d6f6280 | 1,869 | py | Python | ysharp/ysharp_lexer.py | RezSat/Ysharp-v4 | b475864688b0a5c7040ce5d4a8e8e3c5443cb25f | [
"Apache-2.0"
] | null | null | null | ysharp/ysharp_lexer.py | RezSat/Ysharp-v4 | b475864688b0a5c7040ce5d4a8e8e3c5443cb25f | [
"Apache-2.0"
] | null | null | null | ysharp/ysharp_lexer.py | RezSat/Ysharp-v4 | b475864688b0a5c7040ce5d4a8e8e3c5443cb25f | [
"Apache-2.0"
] | null | null | null | from sly import Lexer
class YsharpLexer(Lexer):
tokens = {
ID,
FLOAT,
INT,
FUNC,
CLASS,
STRING,
EQ_GREATER,
EQ_LESS,
EQEQ,
PYTHON_CODE,
COLON_COLON,
IF,
ELSE,
TRUE,
FALSE,
... | 18.145631 | 72 | 0.326913 | from sly import Lexer
class YsharpLexer(Lexer):
tokens = {
ID,
FLOAT,
INT,
FUNC,
CLASS,
STRING,
EQ_GREATER,
EQ_LESS,
EQEQ,
PYTHON_CODE,
COLON_COLON,
IF,
ELSE,
TRUE,
FALSE,
... | true | true |
f74d42a9431d3f39af672b587eec68f30fbbebae | 13,118 | py | Python | peachy/collision.py | shelsoloa/Peachy | 2300f617e26f09ab39e2c5fa1a10226a5b0426b9 | [
"MIT"
] | 2 | 2017-06-24T20:24:30.000Z | 2018-08-12T20:06:24.000Z | peachy/collision.py | shelsoloa/Peachy | 2300f617e26f09ab39e2c5fa1a10226a5b0426b9 | [
"MIT"
] | null | null | null | peachy/collision.py | shelsoloa/Peachy | 2300f617e26f09ab39e2c5fa1a10226a5b0426b9 | [
"MIT"
] | null | null | null | from peachy.geo import ShapeEnum
# Collision functions are alphabetical but prioritze rectangles because
# they are most common
"""The max tolerance for floating point errors."""
TOLERANCE = 0.001
def is_between(x, a, b):
return min(a, b) <= x <= max(a, b)
def rect_to_vector_segments(rect):
x, y, width, h... | 28.455531 | 79 | 0.603979 | from peachy.geo import ShapeEnum
TOLERANCE = 0.001
def is_between(x, a, b):
return min(a, b) <= x <= max(a, b)
def rect_to_vector_segments(rect):
x, y, width, height = rect
top = (x, y, width, 0)
right = (x + width, y, 0, height)
bottom = (x + width, y + height, -width, 0)
left = (x, y +... | true | true |
f74d437fa2a100eaf88e3bd7720402af24c0b2e0 | 3,471 | py | Python | bindings/python/ensmallen/datasets/string/ralstoniainsidiosa.py | AnacletoLAB/ensmallen_graph | b2c1b18fb1e5801712852bcc239f239e03076f09 | [
"MIT"
] | 5 | 2021-02-17T00:44:45.000Z | 2021-08-09T16:41:47.000Z | bindings/python/ensmallen/datasets/string/ralstoniainsidiosa.py | AnacletoLAB/ensmallen_graph | b2c1b18fb1e5801712852bcc239f239e03076f09 | [
"MIT"
] | 18 | 2021-01-07T16:47:39.000Z | 2021-08-12T21:51:32.000Z | bindings/python/ensmallen/datasets/string/ralstoniainsidiosa.py | AnacletoLAB/ensmallen | b2c1b18fb1e5801712852bcc239f239e03076f09 | [
"MIT"
] | 3 | 2021-01-14T02:20:59.000Z | 2021-08-04T19:09:52.000Z | """
This file offers the methods to automatically retrieve the graph Ralstonia insidiosa.
The graph is automatically retrieved from the STRING repository.
References
---------------------
Please cite the following if you use the data:
```bib
@article{szklarczyk2019string,
title={STRING v11: protein--protein as... | 33.057143 | 223 | 0.677615 | from typing import Dict
from ..automatic_graph_retrieval import AutomaticallyRetrievedGraph
from ...ensmallen import Graph
def RalstoniaInsidiosa(
directed: bool = False,
preprocess: bool = True,
load_nodes: bool = True,
verbose: int = 2,
cache: bool = True,
cache_path: str = "graphs/string... | true | true |
f74d4462bce1a8606e96b339178089bb9c90df76 | 1,924 | py | Python | saleor/payment/gateways/braintree/forms.py | cck197/saleor | a150dc2aea9f67b5ce15a82f45c90d68e28195ca | [
"CC-BY-4.0"
] | null | null | null | saleor/payment/gateways/braintree/forms.py | cck197/saleor | a150dc2aea9f67b5ce15a82f45c90d68e28195ca | [
"CC-BY-4.0"
] | null | null | null | saleor/payment/gateways/braintree/forms.py | cck197/saleor | a150dc2aea9f67b5ce15a82f45c90d68e28195ca | [
"CC-BY-4.0"
] | null | null | null | from django import forms
from django.core.exceptions import ValidationError
from django.utils.translation import pgettext_lazy
from ...error_codes import PaymentErrorCode
from ...interface import PaymentData
class BraintreePaymentForm(forms.Form):
amount = forms.DecimalField()
# Unique transaction identifie... | 40.083333 | 105 | 0.690229 | from django import forms
from django.core.exceptions import ValidationError
from django.utils.translation import pgettext_lazy
from ...error_codes import PaymentErrorCode
from ...interface import PaymentData
class BraintreePaymentForm(forms.Form):
amount = forms.DecimalField()
ayment_method_nonce ... | true | true |
f74d453114abdc8a85ae9b29efbe6c07e77dbc4a | 2,797 | py | Python | dataservice/api/cavatica_task/models.py | ConnorBarnhill/kf-api-dataservice | 547df467a307788882469a25c947a14965a26336 | [
"Apache-2.0"
] | null | null | null | dataservice/api/cavatica_task/models.py | ConnorBarnhill/kf-api-dataservice | 547df467a307788882469a25c947a14965a26336 | [
"Apache-2.0"
] | null | null | null | dataservice/api/cavatica_task/models.py | ConnorBarnhill/kf-api-dataservice | 547df467a307788882469a25c947a14965a26336 | [
"Apache-2.0"
] | null | null | null | from sqlalchemy.dialects.postgresql import UUID
from sqlalchemy.ext.associationproxy import association_proxy
from dataservice.extensions import db
from dataservice.api.common.model import Base, KfId
class CavaticaTask(db.Model, Base):
"""
CavaticaTask entity represents an executed Cavatica task
:param ... | 41.746269 | 79 | 0.608509 | from sqlalchemy.dialects.postgresql import UUID
from sqlalchemy.ext.associationproxy import association_proxy
from dataservice.extensions import db
from dataservice.api.common.model import Base, KfId
class CavaticaTask(db.Model, Base):
__tablename__ = 'cavatica_task'
__prefix__ = 'CT'
external_cavatica_... | true | true |
f74d4607da867d9fa5a55f92b1b8130e0a0eff18 | 2,696 | py | Python | .venv/lib/python3.8/site-packages/jeepney/io/common.py | RivtLib/replit01 | ce1ae18b446a9c844f40e88a51c71fbc45ab3ad7 | [
"MIT"
] | 1 | 2021-01-14T15:33:11.000Z | 2021-01-14T15:33:11.000Z | .venv/lib/python3.8/site-packages/jeepney/io/common.py | RivtLib/replit01 | ce1ae18b446a9c844f40e88a51c71fbc45ab3ad7 | [
"MIT"
] | 29 | 2021-08-17T19:09:23.000Z | 2022-03-29T19:08:23.000Z | .venv/lib/python3.8/site-packages/jeepney/io/common.py | RivtLib/replit01 | ce1ae18b446a9c844f40e88a51c71fbc45ab3ad7 | [
"MIT"
] | 2 | 2020-09-10T22:39:34.000Z | 2021-06-27T22:21:55.000Z | from contextlib import contextmanager
from itertools import count
from jeepney import HeaderFields, Message, MessageFlag, MessageType
class MessageFilters:
def __init__(self):
self.filters = {}
self.filter_ids = count()
def matches(self, message):
for handle in self.filters.values():
... | 30.292135 | 77 | 0.643917 | from contextlib import contextmanager
from itertools import count
from jeepney import HeaderFields, Message, MessageFlag, MessageType
class MessageFilters:
def __init__(self):
self.filters = {}
self.filter_ids = count()
def matches(self, message):
for handle in self.filters.values():
... | true | true |
f74d4669b6531efc2617c17c3f4ec7faf64bf4fb | 3,585 | py | Python | Termica.py | afazevedo/MDI_PDE_2030_Linux | 1c6ac0a08fe7fca5478f038173ee91fede680f3a | [
"MIT"
] | null | null | null | Termica.py | afazevedo/MDI_PDE_2030_Linux | 1c6ac0a08fe7fca5478f038173ee91fede680f3a | [
"MIT"
] | null | null | null | Termica.py | afazevedo/MDI_PDE_2030_Linux | 1c6ac0a08fe7fca5478f038173ee91fede680f3a | [
"MIT"
] | null | null | null | from Usina import Usina;
from RecebeDados import RecebeDados;
class Termica(Usina):
def __init__(self, recebe_dados, abaTerm, offset, iTerm, nMeses, nMesesPos, continuidade=False):
# define fonte_dados como o objeto da classe RecebeDados e o nome da aba com as usinas UHE
self.nomeAba ... | 43.719512 | 140 | 0.625662 | from Usina import Usina;
from RecebeDados import RecebeDados;
class Termica(Usina):
def __init__(self, recebe_dados, abaTerm, offset, iTerm, nMeses, nMesesPos, continuidade=False):
self.nomeAba = abaTerm;
self.fonte_dados = recebe_dados;
self.indexUsinaInterno = iTerm... | true | true |
f74d46d14cbea6d13567079d17e29f299b43e70a | 1,182 | py | Python | app/core/models.py | fakorede-bolu/python-recipe-rest-api | 26ee3a9edae5d4ee974b42a741ffb60af63c9cb7 | [
"MIT"
] | null | null | null | app/core/models.py | fakorede-bolu/python-recipe-rest-api | 26ee3a9edae5d4ee974b42a741ffb60af63c9cb7 | [
"MIT"
] | null | null | null | app/core/models.py | fakorede-bolu/python-recipe-rest-api | 26ee3a9edae5d4ee974b42a741ffb60af63c9cb7 | [
"MIT"
] | null | null | null | from django.db import models
from django.contrib.auth.models import AbstractBaseUser, BaseUserManager, \
PermissionsMixin
class UserManager(BaseUserManager):
def create_user(self, email, password=None, **extra_fields):
"""Creates and saves a new user"""
if not email:
raise ValueEr... | 30.307692 | 76 | 0.686971 | from django.db import models
from django.contrib.auth.models import AbstractBaseUser, BaseUserManager, \
PermissionsMixin
class UserManager(BaseUserManager):
def create_user(self, email, password=None, **extra_fields):
if not email:
raise ValueError('User must have a valid email address')... | true | true |
f74d47032ff6861dc47408ee6f4e6f9d27180162 | 3,803 | py | Python | src/ea/libs/PyXmlDict/Test.py | dmachard/extensivetesting | a5c3d2648aebcfaf1d0352a7aff8728ab843b73f | [
"MIT"
] | 9 | 2019-09-01T04:56:28.000Z | 2021-04-08T19:45:52.000Z | src/ea/libs/PyXmlDict/Test.py | dmachard/extensivetesting | a5c3d2648aebcfaf1d0352a7aff8728ab843b73f | [
"MIT"
] | 5 | 2020-10-27T15:05:12.000Z | 2021-12-13T13:48:11.000Z | src/ea/libs/PyXmlDict/Test.py | dmachard/extensivetesting | a5c3d2648aebcfaf1d0352a7aff8728ab843b73f | [
"MIT"
] | 2 | 2019-10-01T06:12:06.000Z | 2020-04-29T13:28:20.000Z | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
# -------------------------------------------------------------------
# Copyright (c) 2010-2021 Denis Machard
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# ... | 34.261261 | 80 | 0.562977 |
import Dict2Xml
import Xml2Dict
if __name__ == '__main__':
codecX2D = Xml2Dict.Xml2Dict()
codecD2X = Dict2Xml.Dict2Xml(coding=None)
xml = """<Family>
<Member Name="Abe" DOB="3/31/42" />
<Member Name="Betty" DOB="2/4/49" />
<Member Name="Edith" Father="Abe" Mother="Betty" DOB="... | true | true |
f74d47a21c13fab8a3bc1d45b2ef4a056cd95bc2 | 2,903 | py | Python | tests/components/smtp/test_notify.py | domwillcode/home-assistant | f170c80bea70c939c098b5c88320a1c789858958 | [
"Apache-2.0"
] | 2 | 2021-09-13T21:44:02.000Z | 2021-12-17T21:20:51.000Z | tests/components/smtp/test_notify.py | domwillcode/home-assistant | f170c80bea70c939c098b5c88320a1c789858958 | [
"Apache-2.0"
] | 5 | 2021-02-08T20:46:31.000Z | 2022-03-12T00:35:09.000Z | tests/components/smtp/test_notify.py | klauern/home-assistant-core | c18ba6aec0627e6afb6442c678edb5ff2bb17db6 | [
"Apache-2.0"
] | 2 | 2020-11-04T07:40:01.000Z | 2021-09-13T21:44:03.000Z | """The tests for the notify smtp platform."""
import re
import unittest
from homeassistant.components.smtp.notify import MailNotificationService
from tests.async_mock import patch
from tests.common import get_test_home_assistant
class MockSMTP(MailNotificationService):
"""Test SMTP object that doesn't need a wo... | 33.367816 | 81 | 0.561144 | import re
import unittest
from homeassistant.components.smtp.notify import MailNotificationService
from tests.async_mock import patch
from tests.common import get_test_home_assistant
class MockSMTP(MailNotificationService):
def _send_email(self, msg):
return msg.as_string()
class TestNotifySmtp(unitt... | true | true |
f74d48a8321d6f6073cc1e3da852cd31ba0178b0 | 2,978 | py | Python | problems/OF/auto/problem80_OF.py | sunandita/ICAPS_Summer_School_RAE_2020 | a496b62185bcfdd2c76eb7986ae99cfa85708d28 | [
"BSD-3-Clause"
] | 5 | 2020-10-15T14:40:03.000Z | 2021-08-20T17:45:41.000Z | problems/OF/auto/problem80_OF.py | sunandita/ICAPS_Summer_School_RAE_2020 | a496b62185bcfdd2c76eb7986ae99cfa85708d28 | [
"BSD-3-Clause"
] | null | null | null | problems/OF/auto/problem80_OF.py | sunandita/ICAPS_Summer_School_RAE_2020 | a496b62185bcfdd2c76eb7986ae99cfa85708d28 | [
"BSD-3-Clause"
] | 2 | 2020-10-15T07:06:14.000Z | 2020-10-15T17:33:01.000Z | __author__ = 'mason'
from domain_orderFulfillment import *
from timer import DURATION
from state import state
import numpy as np
'''
This is a randomly generated problem
'''
def GetCostOfMove(id, r, loc1, loc2, dist):
return 1 + dist
def GetCostOfLookup(id, item):
return max(1, np.random.beta(2, 2))
def Ge... | 35.035294 | 407 | 0.602082 | __author__ = 'mason'
from domain_orderFulfillment import *
from timer import DURATION
from state import state
import numpy as np
def GetCostOfMove(id, r, loc1, loc2, dist):
return 1 + dist
def GetCostOfLookup(id, item):
return max(1, np.random.beta(2, 2))
def GetCostOfWrap(id, orderName, m, item):
retu... | true | true |
f74d48b750865114a03efeb71e464bf93549ef0d | 16,714 | py | Python | data_reader.py | ruanchaves/Dual-encoder-Entity-Retrieval-with-BERT | ff8c7933afaf0b2c40a7df0250f4b82a5868dc2a | [
"MIT"
] | 7 | 2020-11-08T08:30:09.000Z | 2021-07-12T09:50:50.000Z | data_reader.py | ruanchaves/Dual-encoder-Entity-Retrieval-with-BERT | ff8c7933afaf0b2c40a7df0250f4b82a5868dc2a | [
"MIT"
] | 3 | 2020-08-11T03:08:07.000Z | 2020-12-22T12:06:08.000Z | data_reader.py | ruanchaves/Dual-encoder-Entity-Retrieval-with-BERT | ff8c7933afaf0b2c40a7df0250f4b82a5868dc2a | [
"MIT"
] | 1 | 2020-08-10T22:31:17.000Z | 2020-08-10T22:31:17.000Z | import numpy as np
from tqdm import tqdm
import torch
import pdb
from typing import Iterator
from allennlp.data import Instance
from allennlp.data.dataset_readers import DatasetReader
from allennlp.data.token_indexers import TokenIndexer, SingleIdTokenIndexer, PretrainedTransformerIndexer
from allennlp.data.fields impo... | 47.08169 | 176 | 0.682781 | import numpy as np
from tqdm import tqdm
import torch
import pdb
from typing import Iterator
from allennlp.data import Instance
from allennlp.data.dataset_readers import DatasetReader
from allennlp.data.token_indexers import TokenIndexer, SingleIdTokenIndexer, PretrainedTransformerIndexer
from allennlp.data.fields impo... | true | true |
f74d498f0d08acf63fb1170e3442f20e0740ce6e | 2,813 | py | Python | orfd/setting.py | 1uvu/orfd-vec | 3365b06ba742831e4d97204157ef2efef4427711 | [
"MIT"
] | null | null | null | orfd/setting.py | 1uvu/orfd-vec | 3365b06ba742831e4d97204157ef2efef4427711 | [
"MIT"
] | null | null | null | orfd/setting.py | 1uvu/orfd-vec | 3365b06ba742831e4d97204157ef2efef4427711 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
'''
@File : setting.py
@Desc :
@Project : orfd-platform
@Contact : thefreer@outlook.com
@License : (C)Copyright 2018-2019, TheFreer.NET
@WebSite : www.thefreer.net
@Modify Time @Author @Version
------------ ------- ... | 27.31068 | 109 | 0.633132 |
import os
= [
"Company_ID", "companyBaseUrl", "companyTrade", "companyType",
"teamTime", "entUrl", "companyDetailUrl", "Job_ID", "browserNum",
"jobUpdateTime", "jobDetailUrl", "companyName", "estiblishDate",
"companyAddr", "jobAddr", "regAuthority", "businessScope",
]
N_PATH = "./Core/dataset/origin.csv"
DOC_... | true | true |
f74d4b24710c895c6832b12abb2acf50216eb9a4 | 799 | py | Python | cssProject/cssProject/urls.py | cs-fullstack-2019-spring/django-bootstrap-grid-cw-MelaatiJ | 2b25d1d028818dd407d44cf7200861db2883e4d0 | [
"Apache-2.0"
] | null | null | null | cssProject/cssProject/urls.py | cs-fullstack-2019-spring/django-bootstrap-grid-cw-MelaatiJ | 2b25d1d028818dd407d44cf7200861db2883e4d0 | [
"Apache-2.0"
] | null | null | null | cssProject/cssProject/urls.py | cs-fullstack-2019-spring/django-bootstrap-grid-cw-MelaatiJ | 2b25d1d028818dd407d44cf7200861db2883e4d0 | [
"Apache-2.0"
] | null | null | null | """cssProject URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.0/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-ba... | 34.73913 | 77 | 0.703379 | from django.contrib import admin
from django.urls import path, include
urlpatterns = [
path("", include("cssApp.urls")),
path('admin/', admin.site.urls),
]
| true | true |
f74d4b7e610dc83fd46e406c333d443d7a3ed463 | 2,907 | py | Python | util.py | sanjitjain2/soundnet_tf | ba8d85246dbf14f2573ad5b46355ae512bb630de | [
"MIT"
] | null | null | null | util.py | sanjitjain2/soundnet_tf | ba8d85246dbf14f2573ad5b46355ae512bb630de | [
"MIT"
] | null | null | null | util.py | sanjitjain2/soundnet_tf | ba8d85246dbf14f2573ad5b46355ae512bb630de | [
"MIT"
] | null | null | null | import numpy as np
import librosa
# import pdb
import wget
local_config = {
'batch_size': 64,
'load_size': 22050*20,
'phase': 'extract'
}
def get_audio(audio_link):
file_name = audio_link.split('/')[-1]
save_location = "/Users/sanjitjain/projects/soundnet_tf/da... | 31.945055 | 113 | 0.667699 | import numpy as np
import librosa
import wget
local_config = {
'batch_size': 64,
'load_size': 22050*20,
'phase': 'extract'
}
def get_audio(audio_link):
file_name = audio_link.split('/')[-1]
save_location = "/Users/sanjitjain/projects/soundnet_tf/data/"
wge... | true | true |
f74d4c465c838236b8149010306c00a774304142 | 1,659 | py | Python | voltha/core/config/config_branch.py | Balaji-P/voltha_docker_compose-rsk_tech_CKAD | 3cf9b2e2bbbaeed4744ff9f33a3e91e60c8020b7 | [
"Apache-2.0"
] | null | null | null | voltha/core/config/config_branch.py | Balaji-P/voltha_docker_compose-rsk_tech_CKAD | 3cf9b2e2bbbaeed4744ff9f33a3e91e60c8020b7 | [
"Apache-2.0"
] | null | null | null | voltha/core/config/config_branch.py | Balaji-P/voltha_docker_compose-rsk_tech_CKAD | 3cf9b2e2bbbaeed4744ff9f33a3e91e60c8020b7 | [
"Apache-2.0"
] | null | null | null | #
# Copyright 2016 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | 30.722222 | 75 | 0.693189 |
from collections import OrderedDict
from weakref import WeakValueDictionary
class ConfigBranch(object):
__slots__ = (
'_node',
'_txid',
'_origin',
'_revs',
'_latest',
'__weakref__'
)
def __init__(self, node, txid=None, origin=Non... | true | true |
f74d4c4c48852a0a927200d61c334853bd8ee144 | 4,502 | py | Python | Lib/gftools/actions/updateupstream.py | moontypespace/gftools | 9ff6932eb887e4c1e05dd94107aa0c3438ae26a9 | [
"Apache-2.0"
] | null | null | null | Lib/gftools/actions/updateupstream.py | moontypespace/gftools | 9ff6932eb887e4c1e05dd94107aa0c3438ae26a9 | [
"Apache-2.0"
] | null | null | null | Lib/gftools/actions/updateupstream.py | moontypespace/gftools | 9ff6932eb887e4c1e05dd94107aa0c3438ae26a9 | [
"Apache-2.0"
] | null | null | null | """Generates an upstream.yaml from a config.yaml and a GitHub release URL
"""
import argparse
import os
from tempfile import TemporaryDirectory
import yaml
import zipfile
import gftools.packager
from gftools.builder import GFBuilder
from strictyaml import as_document
from gftools.utils import download_file
from fontT... | 34.366412 | 103 | 0.582852 | import argparse
import os
from tempfile import TemporaryDirectory
import yaml
import zipfile
import gftools.packager
from gftools.builder import GFBuilder
from strictyaml import as_document
from gftools.utils import download_file
from fontTools.ttLib import TTFont
parser = argparse.ArgumentParser(description="Proces... | true | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.