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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f7402441c98e12bfd89f226ed254422ac0373687 | 2,924 | py | Python | social_auth/backends/contrib/dailymotion.py | Sponsorcraft/django-social-auth | 093fde0b8aed9875ce077364ec368cbd3d7a8c7c | [
"BSD-2-Clause",
"BSD-3-Clause"
] | 3 | 2015-05-18T13:51:29.000Z | 2015-05-18T14:39:08.000Z | social_auth/backends/contrib/dailymotion.py | gugu/django-social-auth-1 | e47512f568b7dc7d247d0f667d8ef34972beb1d1 | [
"BSD-2-Clause",
"BSD-3-Clause"
] | null | null | null | social_auth/backends/contrib/dailymotion.py | gugu/django-social-auth-1 | e47512f568b7dc7d247d0f667d8ef34972beb1d1 | [
"BSD-2-Clause",
"BSD-3-Clause"
] | null | null | null | """
Dailymotion OAuth2 support.
This adds support for Dailymotion OAuth service. An application must
be registered first on dailymotion and the settings DAILYMOTION_CONSUMER_KEY
and DAILYMOTION_CONSUMER_SECRET must be defined with the corresponding
values.
User screen name is used to generate username.
By default ac... | 34.809524 | 78 | 0.72606 | from urllib2 import HTTPError
from django.utils import simplejson
from social_auth.utils import dsa_urlopen
from social_auth.backends import BaseOAuth2
from social_auth.backends import SocialAuthBackend
from social_auth.exceptions import AuthCanceled
DAILYMOTION_SERVER = 'api.dailymotion.com'
DAILYMOTION_REQUEST_T... | true | true |
f74026356879c2c78651f4b68513a4d0d5ff04e5 | 1,162 | py | Python | src/slave/preprocess.py | emanuelibiapino/micro_cluster | 42ecf3d50aea1e8ec70d3782cac3e440ea08194c | [
"MIT"
] | null | null | null | src/slave/preprocess.py | emanuelibiapino/micro_cluster | 42ecf3d50aea1e8ec70d3782cac3e440ea08194c | [
"MIT"
] | null | null | null | src/slave/preprocess.py | emanuelibiapino/micro_cluster | 42ecf3d50aea1e8ec70d3782cac3e440ea08194c | [
"MIT"
] | null | null | null | from nltk.corpus import stopwords
from nltk.tokenize import word_tokenize
from nltk import RegexpTokenizer
import re
def regex_clean_ruidos(text):
'''
função manual para eliminação de ruídos através de regex, descartar qualquer coisa
que na composição possua uma 'não letra', como símbolos e núme... | 25.26087 | 95 | 0.629948 | from nltk.corpus import stopwords
from nltk.tokenize import word_tokenize
from nltk import RegexpTokenizer
import re
def regex_clean_ruidos(text):
return ' '.join([
t for t in text.strip().split() if re.match(r'[^\W\d]*$', t)
])
def regex_clean(text):
return regex_clean_ruidos(
' '.jo... | true | true |
f740264d9f938f8fa3775e0f9dd3d52f62ad9885 | 1,810 | py | Python | umm-python/app/web/rest/task_step_api.py | suomitek/cubeai | cc4c0f5f445a552d239910da63944307c1f06e37 | [
"Apache-2.0"
] | null | null | null | umm-python/app/web/rest/task_step_api.py | suomitek/cubeai | cc4c0f5f445a552d239910da63944307c1f06e37 | [
"Apache-2.0"
] | null | null | null | umm-python/app/web/rest/task_step_api.py | suomitek/cubeai | cc4c0f5f445a552d239910da63944307c1f06e37 | [
"Apache-2.0"
] | null | null | null | import tornado.web
from app.domain.task_step import TaskStep
from app.service import token_service
from app.database import task_step_db
from app.utils import mytime
import json
class TaskStepApi(tornado.web.RequestHandler):
async def post(self, *args, **kwargs):
token = token_service.get_token(self.requ... | 31.754386 | 121 | 0.640884 | import tornado.web
from app.domain.task_step import TaskStep
from app.service import token_service
from app.database import task_step_db
from app.utils import mytime
import json
class TaskStepApi(tornado.web.RequestHandler):
async def post(self, *args, **kwargs):
token = token_service.get_token(self.requ... | true | true |
f7402800d6e71d8a4bc10bfbe970233f01d441b7 | 4,159 | py | Python | rlcard/agents/human_agents/gin_rummy_human_agent/gui_gin_rummy/info_messaging.py | randombenj/rlcard | 0948035d26e1b619c068360326f12451f5d28f8b | [
"MIT"
] | 1,735 | 2019-09-05T12:49:43.000Z | 2022-03-30T12:02:07.000Z | rlcard/agents/human_agents/gin_rummy_human_agent/gui_gin_rummy/info_messaging.py | randombenj/rlcard | 0948035d26e1b619c068360326f12451f5d28f8b | [
"MIT"
] | 197 | 2019-09-14T05:59:02.000Z | 2022-03-03T19:21:19.000Z | rlcard/agents/human_agents/gin_rummy_human_agent/gui_gin_rummy/info_messaging.py | randombenj/rlcard | 0948035d26e1b619c068360326f12451f5d28f8b | [
"MIT"
] | 476 | 2019-09-13T15:25:32.000Z | 2022-03-29T01:41:29.000Z | '''
Project: Gui Gin Rummy
File name: info_messaging.py
Author: William Hale
Date created: 3/28/2020
'''
# from __future__ import annotations
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from .game_canvas import GameCanvas
from typing import List
import rlcard.games.gin_rummy.utils.utils as... | 41.178218 | 119 | 0.683337 |
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from .game_canvas import GameCanvas
from typing import List
import rlcard.games.gin_rummy.utils.utils as gin_rummy_utils
from rlcard.games.gin_rummy.utils.thinker import Thinker
from .canvas_item import CardItem
from . import configurations
def blank_info_me... | true | true |
f7402975bd914baa7f2848760975ead90431866c | 828 | py | Python | core/migrations/0002_auto_20150126_1611.py | Siikakala/kompassi | 14cdcd966ab689d762cc885e28b6d15465c216f0 | [
"CC-BY-3.0"
] | null | null | null | core/migrations/0002_auto_20150126_1611.py | Siikakala/kompassi | 14cdcd966ab689d762cc885e28b6d15465c216f0 | [
"CC-BY-3.0"
] | null | null | null | core/migrations/0002_auto_20150126_1611.py | Siikakala/kompassi | 14cdcd966ab689d762cc885e28b6d15465c216f0 | [
"CC-BY-3.0"
] | null | null | null | # -*- coding: utf-8 -*-
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('core', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='event',
name='logo_url',
field=models.CharField(defau... | 31.846154 | 205 | 0.629227 |
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('core', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='event',
name='logo_url',
field=models.CharField(default='', help_text='Voi o... | true | true |
f74029e0841e139c562e14d2f486103d2f9ffb47 | 12,070 | py | Python | PC/application_pc.py | LukiBa/zybo_face | 5f229818727b65ffa82efee2f63522234364fbe2 | [
"MIT"
] | null | null | null | PC/application_pc.py | LukiBa/zybo_face | 5f229818727b65ffa82efee2f63522234364fbe2 | [
"MIT"
] | null | null | null | PC/application_pc.py | LukiBa/zybo_face | 5f229818727b65ffa82efee2f63522234364fbe2 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""
Created on Wed Dec 1 18:09:27 2021
@author: lukas
"""
import cv2
import dlib
import numpy as np
import timeit
import utils
import queue
import multiprocessing
import pathlib
import argparse
import time
def _create_parser():
parser = argparse.ArgumentParser()
parser.add_argument(... | 40.099668 | 124 | 0.599171 |
import cv2
import dlib
import numpy as np
import timeit
import utils
import queue
import multiprocessing
import pathlib
import argparse
import time
def _create_parser():
parser = argparse.ArgumentParser()
parser.add_argument('--descriptor_file', type=str,
default='./saved_descriptors... | true | true |
f7402a374775523fcf6b679ffe30baedc1452878 | 6,346 | py | Python | model-optimizer/mo/middle/passes/fusing/fuse_grouped_conv.py | calvinfeng/openvino | 11f591c16852637506b1b40d083b450e56d0c8ac | [
"Apache-2.0"
] | null | null | null | model-optimizer/mo/middle/passes/fusing/fuse_grouped_conv.py | calvinfeng/openvino | 11f591c16852637506b1b40d083b450e56d0c8ac | [
"Apache-2.0"
] | 19 | 2021-03-26T08:11:00.000Z | 2022-02-21T13:06:26.000Z | model-optimizer/mo/middle/passes/fusing/fuse_grouped_conv.py | calvinfeng/openvino | 11f591c16852637506b1b40d083b450e56d0c8ac | [
"Apache-2.0"
] | 1 | 2021-07-28T17:30:46.000Z | 2021-07-28T17:30:46.000Z | """
Copyright (C) 2018-2021 Intel Corporation
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 i... | 38.695122 | 131 | 0.624961 |
import logging as log
import numpy as np
from mo.graph.graph import Node, Graph
from mo.middle.passes.fusing.helpers import get_next_operation
def concat_convolutions(graph: Graph, start_node: Node, last_node: Node):
conv_nodes = get_next_operation(start_node)
assert len(conv_nodes) == len(last_node... | true | true |
f7402ce7bceafcfe00e36b1c5ee9e7caf9c33bcf | 7,558 | bzl | Python | bazel/google_cloud_cpp_deps.bzl | cojenco/google-cloud-cpp | 1f61ce44c9e757421835e6085b04f6f4150f7b37 | [
"Apache-2.0"
] | null | null | null | bazel/google_cloud_cpp_deps.bzl | cojenco/google-cloud-cpp | 1f61ce44c9e757421835e6085b04f6f4150f7b37 | [
"Apache-2.0"
] | null | null | null | bazel/google_cloud_cpp_deps.bzl | cojenco/google-cloud-cpp | 1f61ce44c9e757421835e6085b04f6f4150f7b37 | [
"Apache-2.0"
] | null | null | null | # Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | 43.188571 | 116 | 0.648055 |
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive", "http_file")
def google_cloud_cpp_deps():
if "rules_cc" not in native.existing_rules():
http_archive(
name = "rules_cc",
strip_prefix = "rules_cc-daf6ace7cfeacd6a83e9ff2ed659f416537b6c74",
... | true | true |
f7402cf3af2ad2ecefafc8b421c17a5c4dee05e7 | 839 | py | Python | my_happy_python_utils/path_utils.py | ggservice007/my-happy-python-utils | 146cee791447339f72a153b941d4cd4be5697025 | [
"Apache-2.0"
] | null | null | null | my_happy_python_utils/path_utils.py | ggservice007/my-happy-python-utils | 146cee791447339f72a153b941d4cd4be5697025 | [
"Apache-2.0"
] | null | null | null | my_happy_python_utils/path_utils.py | ggservice007/my-happy-python-utils | 146cee791447339f72a153b941d4cd4be5697025 | [
"Apache-2.0"
] | null | null | null | import os, sys, inspect
import subprocess
from . import version
__version__ = version.get_current()
def get_current_dir_for_jupyter():
"""Get the current path for jupyter"""
return getCurrentDir(os.getcwd())
def get_current_dir(current_file):
"""Get the current path"""
current_dir = os.path.dirna... | 20.975 | 47 | 0.713945 | import os, sys, inspect
import subprocess
from . import version
__version__ = version.get_current()
def get_current_dir_for_jupyter():
return getCurrentDir(os.getcwd())
def get_current_dir(current_file):
current_dir = os.path.dirname(current_file)
return current_dir
def get_parent_dir(current_file... | true | true |
f7402d4e8430b166f3b0d7c27628f39303c4a186 | 3,738 | py | Python | lib/utils/utils.py | tasx0823/BBN | bd477907482774970eafac3c24dbf83bddae27ff | [
"MIT"
] | 620 | 2019-12-04T09:09:22.000Z | 2022-03-22T08:46:27.000Z | lib/utils/utils.py | ChenAnno/BBN | 7992e908842f5934f0d1ee3f430d796621e81975 | [
"MIT"
] | 30 | 2019-12-21T11:07:59.000Z | 2022-03-12T00:19:08.000Z | lib/utils/utils.py | ChenAnno/BBN | 7992e908842f5934f0d1ee3f430d796621e81975 | [
"MIT"
] | 98 | 2019-12-10T06:41:35.000Z | 2022-03-21T12:51:19.000Z | import logging
import time
import os
import torch
from utils.lr_scheduler import WarmupMultiStepLR
from net import Network
def create_logger(cfg):
dataset = cfg.DATASET.DATASET
net_type = cfg.BACKBONE.TYPE
module_type = cfg.MODULE.TYPE
log_dir = os.path.join(cfg.OUTPUT_DIR, cfg.NAME, "lo... | 33.375 | 102 | 0.603799 | import logging
import time
import os
import torch
from utils.lr_scheduler import WarmupMultiStepLR
from net import Network
def create_logger(cfg):
dataset = cfg.DATASET.DATASET
net_type = cfg.BACKBONE.TYPE
module_type = cfg.MODULE.TYPE
log_dir = os.path.join(cfg.OUTPUT_DIR, cfg.NAME, "lo... | true | true |
f7402d64f3089e887964b8fdd46515d789bb343e | 1,093 | py | Python | parallel-nn/distributed/dist.py | AbsoluteStratos/blog-code | 3a8e308d55931b053b8a47268c52d62e0fa16bd8 | [
"MIT"
] | 2 | 2021-07-30T10:04:18.000Z | 2022-01-30T18:29:30.000Z | parallel-nn/distributed/dist.py | AbsoluteStratos/blog-code | 3a8e308d55931b053b8a47268c52d62e0fa16bd8 | [
"MIT"
] | 1 | 2021-10-17T20:08:41.000Z | 2021-10-17T20:08:41.000Z | parallel-nn/distributed/dist.py | AbsoluteStratos/blog-code | 3a8e308d55931b053b8a47268c52d62e0fa16bd8 | [
"MIT"
] | 2 | 2021-07-30T10:04:20.000Z | 2021-09-01T00:07:14.000Z | '''
Learning How To Train Neural Networks in Parallel (The Right Way)
===
Author: Nicholas Geneva (MIT Liscense)
url: https://nicholasgeneva.com/blog/
github: https://github.com/NickGeneva/blog-code
===
'''
from abc import abstractmethod
class Distributed(object):
"""Parent class for distributed comm methods
... | 24.840909 | 84 | 0.680695 | from abc import abstractmethod
class Distributed(object):
@property
def size(self):
return 1
@property
def rank(self):
return 0
@property
def comm(self):
return None
@property
def name(self):
return ""
@abstractmethod
def barrier(self):
... | true | true |
f7402de6b06503d2e9a555967b8a67041880ae08 | 409 | py | Python | Python/employee directory.py | BlackTimber-Labs/DemoPr | 6495b5307323ce17be5071006f1de90a1120edf4 | [
"MIT"
] | 10 | 2021-10-01T15:11:27.000Z | 2021-10-03T10:41:36.000Z | Python/employee directory.py | BlackTimber-Labs/DemoPr | 6495b5307323ce17be5071006f1de90a1120edf4 | [
"MIT"
] | 102 | 2021-10-01T14:49:50.000Z | 2021-10-31T17:30:15.000Z | Python/employee directory.py | BlackTimber-Labs/DemoPr | 6495b5307323ce17be5071006f1de90a1120edf4 | [
"MIT"
] | 88 | 2021-10-01T14:28:10.000Z | 2021-10-31T12:02:42.000Z | #Program to find the phone number of an employee
phone=dict()
i=1
n=int(input("Enter the no. of entries:"))
while i<=n:
a=input("Enter the phone number:")
b=input("Enter name:")
phone[b]=a
i=i+1
l=phone.keys()
x=input("Enter the name to be searched:")
for i in l:
if i==x:
print(... | 21.526316 | 49 | 0.584352 |
phone=dict()
i=1
n=int(input("Enter the no. of entries:"))
while i<=n:
a=input("Enter the phone number:")
b=input("Enter name:")
phone[b]=a
i=i+1
l=phone.keys()
x=input("Enter the name to be searched:")
for i in l:
if i==x:
print(x,"phone number:",phone[i])
break
else:... | true | true |
f7402efbd4b32c2c99085a9c25781dc63017b65b | 100 | py | Python | include/tclap-1.4.0-rc1/tests/test74.py | SpaceKatt/cpp-cli-poc | 02ffefea2fc6e999fa2b27d08a8b3be6830b1b97 | [
"BSL-1.0"
] | 62 | 2021-09-21T18:58:02.000Z | 2022-03-07T02:17:43.000Z | third_party/tclap-1.4.0-rc1/tests/test74.py | Vertexwahn/FlatlandRT | 37d09fde38b25eff5f802200b43628efbd1e3198 | [
"Apache-2.0"
] | null | null | null | third_party/tclap-1.4.0-rc1/tests/test74.py | Vertexwahn/FlatlandRT | 37d09fde38b25eff5f802200b43628efbd1e3198 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/python
import simple_test
simple_test.test("test20", ["-a", "-b", ], expect_fail=True)
| 16.666667 | 60 | 0.67 |
import simple_test
simple_test.test("test20", ["-a", "-b", ], expect_fail=True)
| true | true |
f7402f69eab70dc018d8e937e8665ca9c99debb4 | 20,941 | py | Python | TMProcessing/tm_splitter.py | USPTO/TrademarkPublicData | f1b333502dea7249c2ad12fb0c9bae3f7c1f8206 | [
"CC0-1.0"
] | 20 | 2017-10-14T14:10:22.000Z | 2021-09-06T22:11:09.000Z | TMProcessing/tm_splitter.py | USPTO/TrademarkPublicData | f1b333502dea7249c2ad12fb0c9bae3f7c1f8206 | [
"CC0-1.0"
] | 2 | 2018-10-23T14:25:35.000Z | 2020-01-20T22:28:36.000Z | TMProcessing/tm_splitter.py | USPTO/TrademarkPublicData | f1b333502dea7249c2ad12fb0c9bae3f7c1f8206 | [
"CC0-1.0"
] | 7 | 2018-01-04T18:53:18.000Z | 2021-01-06T11:33:15.000Z | #!/usr/bin/python3
# tm_splitter.py by Michael Henderson
# Split individual TM files from a bulk downloaded XML file containing an aggregation of TMs
# Write out a separate XML files and Solr ready XML file for each TM
import os
import re
import sys
import getopt
import xml.dom.minidom
def main(argv):
#de... | 40.426641 | 393 | 0.598825 |
import os
import re
import sys
import getopt
import xml.dom.minidom
def main(argv):
bulk_tm_file = 'apc161231-56-test.xml'
output_directory = 'tm_corpus'
xml_tag ='<?xml version=\"1.0\" encoding=\"UTF-8\"?>'
start_xml_pattern = re.compile("(?P<xml_tag><\?xml[^>]+\?>[\s]*?)", r... | true | true |
f7402ff23ea4a358ec9a231087bd021fbaff290c | 1,494 | py | Python | patronclient/tests/unit/fixture_data/cloudpipe.py | casbin/openstack-patron | b41b1262f3a52c8cc9f6b6bdf87be5a1abcf6d25 | [
"Apache-2.0"
] | null | null | null | patronclient/tests/unit/fixture_data/cloudpipe.py | casbin/openstack-patron | b41b1262f3a52c8cc9f6b6bdf87be5a1abcf6d25 | [
"Apache-2.0"
] | null | null | null | patronclient/tests/unit/fixture_data/cloudpipe.py | casbin/openstack-patron | b41b1262f3a52c8cc9f6b6bdf87be5a1abcf6d25 | [
"Apache-2.0"
] | null | null | null | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | 39.315789 | 75 | 0.61178 |
from patronclient.tests.unit.fixture_data import base
class Fixture(base.Fixture):
base_url = 'os-cloudpipe'
def setUp(self):
super(Fixture, self).setUp()
get_os_cloudpipe = {'cloudpipes': [{'project_id': 1}]}
self.requests.register_uri('GET', self.url(),
... | true | true |
f740302e3c91af8002d123f8013ea5f073ba4765 | 1,299 | py | Python | sdk/servicebus/azure-servicebus/tests/perf_tests/T1_legacy_tests/receive_message_stream.py | rsdoherty/azure-sdk-for-python | 6bba5326677468e6660845a703686327178bb7b1 | [
"MIT"
] | 2,728 | 2015-01-09T10:19:32.000Z | 2022-03-31T14:50:33.000Z | sdk/servicebus/azure-servicebus/tests/perf_tests/T1_legacy_tests/receive_message_stream.py | rsdoherty/azure-sdk-for-python | 6bba5326677468e6660845a703686327178bb7b1 | [
"MIT"
] | 17,773 | 2015-01-05T15:57:17.000Z | 2022-03-31T23:50:25.000Z | sdk/servicebus/azure-servicebus/tests/perf_tests/T1_legacy_tests/receive_message_stream.py | rsdoherty/azure-sdk-for-python | 6bba5326677468e6660845a703686327178bb7b1 | [
"MIT"
] | 1,916 | 2015-01-19T05:05:41.000Z | 2022-03-31T19:36:44.000Z | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | 33.307692 | 94 | 0.452656 |
import asyncio
from ._test_base import _ReceiveTest
class LegacyReceiveMessageStreamTest(_ReceiveTest):
def run_sync(self):
count = 0
if self.args.peeklock:
for msg in self.receiver:
if count >= self.args.num_messages:
break
cou... | true | true |
f740304df6fe1432a122d59e3dba42c15e3c9dc4 | 407 | py | Python | script.py | baluyotraf/flask-basic | 31658b8b57dab8c1379de9b177cc0e0b3fab3059 | [
"MIT"
] | null | null | null | script.py | baluyotraf/flask-basic | 31658b8b57dab8c1379de9b177cc0e0b3fab3059 | [
"MIT"
] | null | null | null | script.py | baluyotraf/flask-basic | 31658b8b57dab8c1379de9b177cc0e0b3fab3059 | [
"MIT"
] | 2 | 2018-10-06T00:42:05.000Z | 2019-06-27T05:45:57.000Z | import click
from flask.cli import FlaskGroup
from app import app, db
@click.group(cls=FlaskGroup, create_app=lambda: app)
def cli():
"""Management script for the flask application."""
@cli.command()
def init_db():
"""Creates database tables"""
db.create_all()
@cli.command()
def delete_db():
"""De... | 15.653846 | 54 | 0.670762 | import click
from flask.cli import FlaskGroup
from app import app, db
@click.group(cls=FlaskGroup, create_app=lambda: app)
def cli():
@cli.command()
def init_db():
db.create_all()
@cli.command()
def delete_db():
db.drop_all()
if __name__ == '__main__':
cli()
| true | true |
f74030980e795b4229a83c0c28cd1942de09f49c | 370 | py | Python | accounts/admin.py | xarg/snippify | b692a941a7a46959df9aff064b7ad056d0125484 | [
"MIT"
] | 2 | 2016-08-19T06:24:02.000Z | 2021-05-11T00:08:24.000Z | accounts/admin.py | xarg/snippify | b692a941a7a46959df9aff064b7ad056d0125484 | [
"MIT"
] | 5 | 2021-05-01T15:03:07.000Z | 2021-05-01T15:03:08.000Z | accounts/admin.py | xarg/snippify | b692a941a7a46959df9aff064b7ad056d0125484 | [
"MIT"
] | null | null | null | from django.contrib import admin
from models import UserFollow, UserProfile
class UserFollowAdmin(admin.ModelAdmin):
list_display=['user', 'followed_user']
class UserProfileAdmin(admin.ModelAdmin):
list_display=['user', 'location', 'url', 'profile_privacy']
admin.site.register(UserFollow, UserFollowAdmin)
a... | 28.461538 | 63 | 0.791892 | from django.contrib import admin
from models import UserFollow, UserProfile
class UserFollowAdmin(admin.ModelAdmin):
list_display=['user', 'followed_user']
class UserProfileAdmin(admin.ModelAdmin):
list_display=['user', 'location', 'url', 'profile_privacy']
admin.site.register(UserFollow, UserFollowAdmin)
a... | true | true |
f74030de8cdf79242bfc746396c7505043f02353 | 13,463 | py | Python | test/functional/feature_dbcrash.py | ravenjetcoin/ravenjetcoin | 6b76a19818f26ffde5bc9dd6bb5385143d8417b3 | [
"MIT"
] | null | null | null | test/functional/feature_dbcrash.py | ravenjetcoin/ravenjetcoin | 6b76a19818f26ffde5bc9dd6bb5385143d8417b3 | [
"MIT"
] | null | null | null | test/functional/feature_dbcrash.py | ravenjetcoin/ravenjetcoin | 6b76a19818f26ffde5bc9dd6bb5385143d8417b3 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# Copyright (c) 2017 The Bitcoin Core developers
# Copyright (c) 2017-2018 The Marlin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test recovery from a crash during chainstate writing.
... | 47.40493 | 120 | 0.640125 |
import errno
import http.client
import random
import sys
import time
from test_framework.mininode import *
from test_framework.script import *
from test_framework.test_framework import MarlinTestFramework
from test_framework.util import *
HTTP_DISCONNECT_ERRORS = [http.client.CannotSendRequest]
try:
HTTP_DI... | true | true |
f74031c02fb16e976fe188386f78e5c05e47f2a2 | 400 | py | Python | mycal/attendance/migrations/0014_auto_20201117_1453.py | mjhow4/newattendanceapp | 685173631fc7cf7e56923e27f47d405629633386 | [
"MIT"
] | null | null | null | mycal/attendance/migrations/0014_auto_20201117_1453.py | mjhow4/newattendanceapp | 685173631fc7cf7e56923e27f47d405629633386 | [
"MIT"
] | null | null | null | mycal/attendance/migrations/0014_auto_20201117_1453.py | mjhow4/newattendanceapp | 685173631fc7cf7e56923e27f47d405629633386 | [
"MIT"
] | null | null | null | # Generated by Django 3.1.3 on 2020-11-17 19:53
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('attendance', '0013_auto_20201115_1154'),
]
operations = [
migrations.AlterField(
model_name='case',
name='attorney',... | 21.052632 | 61 | 0.605 |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('attendance', '0013_auto_20201115_1154'),
]
operations = [
migrations.AlterField(
model_name='case',
name='attorney',
field=models.CharField(max_length=... | true | true |
f74031d0561e95af36c7d887a7437ab70081dd23 | 663 | py | Python | crosscap/yamlhack.py | corydodt/Crosscap | f93ccd9d038a4482a84a6e9f5d4f91f78620383d | [
"MIT"
] | 1 | 2019-03-11T20:25:36.000Z | 2019-03-11T20:25:36.000Z | crosscap/yamlhack.py | corydodt/Crosscap | f93ccd9d038a4482a84a6e9f5d4f91f78620383d | [
"MIT"
] | 14 | 2018-01-25T19:11:57.000Z | 2020-12-22T19:30:11.000Z | crosscap/yamlhack.py | corydodt/Crosscap | f93ccd9d038a4482a84a6e9f5d4f91f78620383d | [
"MIT"
] | null | null | null | """
Make yaml respect OrderedDicts and stop sorting things
"""
from collections import OrderedDict
import sys
import yaml
_items = 'viewitems' if sys.version_info < (3,) else 'items'
def map_representer(dumper, data):
return dumper.represent_dict(getattr(data, _items)())
def map_constructor(loader, node): # ... | 24.555556 | 80 | 0.760181 | from collections import OrderedDict
import sys
import yaml
_items = 'viewitems' if sys.version_info < (3,) else 'items'
def map_representer(dumper, data):
return dumper.represent_dict(getattr(data, _items)())
def map_constructor(loader, node):
loader.flatten_mapping(node)
return OrderedDict(loader.c... | true | true |
f74033924f64e434b9c1d3d0500160627c9e1819 | 101,053 | py | Python | pandas/core/internals/blocks.py | dwhu/pandas | 283fa07e723fac091685366ba83727624748fddb | [
"BSD-3-Clause"
] | 1 | 2021-12-16T20:01:21.000Z | 2021-12-16T20:01:21.000Z | pandas/core/internals/blocks.py | dwhu/pandas | 283fa07e723fac091685366ba83727624748fddb | [
"BSD-3-Clause"
] | null | null | null | pandas/core/internals/blocks.py | dwhu/pandas | 283fa07e723fac091685366ba83727624748fddb | [
"BSD-3-Clause"
] | 1 | 2020-01-24T06:01:29.000Z | 2020-01-24T06:01:29.000Z | from datetime import datetime, timedelta
import functools
import inspect
import re
from typing import Any, List
import warnings
import numpy as np
from pandas._libs import NaT, algos as libalgos, lib, tslib, writers
from pandas._libs.index import convert_scalar
import pandas._libs.internals as libinternals
from panda... | 32.121106 | 88 | 0.578508 | from datetime import datetime, timedelta
import functools
import inspect
import re
from typing import Any, List
import warnings
import numpy as np
from pandas._libs import NaT, algos as libalgos, lib, tslib, writers
from pandas._libs.index import convert_scalar
import pandas._libs.internals as libinternals
from panda... | true | true |
f74033da7c11750aca320824dd67776fc359e857 | 12,022 | py | Python | userbot/modules/afk.py | Xlaaf/One4uBot | 6d142b9621c1bbd76bc5c07759f5c13c646281d1 | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | 77 | 2020-02-09T19:23:30.000Z | 2021-12-21T16:13:43.000Z | userbot/modules/afk.py | Xlaaf/One4uBot | 6d142b9621c1bbd76bc5c07759f5c13c646281d1 | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | 20 | 2020-03-23T15:22:09.000Z | 2021-09-28T09:30:54.000Z | userbot/modules/afk.py | Xlaaf/One4uBot | 6d142b9621c1bbd76bc5c07759f5c13c646281d1 | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | 1,011 | 2020-02-01T10:04:35.000Z | 2022-03-26T13:08:07.000Z | # Copyright (C) 2019 The Raphielscape Company LLC.
#
# Licensed under the Raphielscape Public License, Version 1.d (the "License");
# you may not use this file except in compliance with the License.
#
""" Userbot module which contains afk-related commands """
import time
from datetime import datetime
from random impor... | 38.408946 | 273 | 0.542006 |
import time
from datetime import datetime
from random import choice, randint
from telethon.events import StopPropagation
from userbot import (
AFKREASON,
COUNT_MSG,
CMD_HELP,
ISAFK,
BOTLOG,
BOTLOG_CHATID,
USERS,
PM_AUTO_BAN)
from userbot.events import register
AFKSTR = [
... | true | true |
f74036196ac3e4237968b676526d67eaa30593a3 | 3,314 | py | Python | blog/blog/settings.py | AminAbdisamad/django-blog | ee730f2c86d6ffa4549e68b81cb5ea10dd2f6f91 | [
"MIT"
] | 1 | 2019-03-06T15:22:36.000Z | 2019-03-06T15:22:36.000Z | blog/blog/settings.py | AminAbdisamad/django-app | ee730f2c86d6ffa4549e68b81cb5ea10dd2f6f91 | [
"MIT"
] | null | null | null | blog/blog/settings.py | AminAbdisamad/django-app | ee730f2c86d6ffa4549e68b81cb5ea10dd2f6f91 | [
"MIT"
] | null | null | null | """
Django settings for blog project.
Generated by 'django-admin startproject' using Django 2.1.5.
For more information on this file, see
https://docs.djangoproject.com/en/2.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.1/ref/settings/
"""
import os
# Bu... | 25.689922 | 91 | 0.698552 |
import os
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SECRET_KEY = '(-0u)#m+=0@9fs51dhk5y#dfnnqac%krz5ry=$u-2zg@1ar1px'
DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = [
'users.apps.UsersConfig',
'pages.apps.PagesConfig',
'crispy_forms',
... | true | true |
f74036e8bb4d4ebcfc75ad384f3133cb732cdf4c | 921 | py | Python | WebMirror/management/rss_parser_funcs/feed_parse_extractMaynoveltranslationsCom.py | fake-name/ReadableWebProxy | ed5c7abe38706acc2684a1e6cd80242a03c5f010 | [
"BSD-3-Clause"
] | 193 | 2016-08-02T22:04:35.000Z | 2022-03-09T20:45:41.000Z | WebMirror/management/rss_parser_funcs/feed_parse_extractMaynoveltranslationsCom.py | fake-name/ReadableWebProxy | ed5c7abe38706acc2684a1e6cd80242a03c5f010 | [
"BSD-3-Clause"
] | 533 | 2016-08-23T20:48:23.000Z | 2022-03-28T15:55:13.000Z | WebMirror/management/rss_parser_funcs/feed_parse_extractMaynoveltranslationsCom.py | rrosajp/ReadableWebProxy | ed5c7abe38706acc2684a1e6cd80242a03c5f010 | [
"BSD-3-Clause"
] | 19 | 2015-08-13T18:01:08.000Z | 2021-07-12T17:13:09.000Z | def extractMaynoveltranslationsCom(item):
'''
Parser for 'maynoveltranslations.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('president shen always top up money', 'president shen alw... | 40.043478 | 120 | 0.566775 | def extractMaynoveltranslationsCom(item):
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('president shen always top up money', 'president shen always top up money', 'translat... | true | true |
f74036fe01eb8abb678f091cfd1ae053795c8e42 | 207 | py | Python | models/__init__.py | hackerekcah/conv-hcpc | 1ac4a558e38bdba68162bfcc5cd8b2b7c8eea1b9 | [
"MIT"
] | null | null | null | models/__init__.py | hackerekcah/conv-hcpc | 1ac4a558e38bdba68162bfcc5cd8b2b7c8eea1b9 | [
"MIT"
] | null | null | null | models/__init__.py | hackerekcah/conv-hcpc | 1ac4a558e38bdba68162bfcc5cd8b2b7c8eea1b9 | [
"MIT"
] | null | null | null | ARCH_REGISTRY = dict()
def register_arch(cls):
ARCH_REGISTRY[cls.__name__] = cls
return cls
# explicitly import all models to register arch
from models import conv1d
__all__ = ["register_arch"] | 15.923077 | 47 | 0.73913 | ARCH_REGISTRY = dict()
def register_arch(cls):
ARCH_REGISTRY[cls.__name__] = cls
return cls
from models import conv1d
__all__ = ["register_arch"] | true | true |
f74037bbdfd8b70f3219b796e42e9e376e2378a7 | 263 | py | Python | server/app/api_1_0/__init__.py | ju1115kr/hash-brown | 93c5e636404608c7cba889cc9f9e0f3d3d0723b2 | [
"Apache-2.0"
] | 4 | 2018-06-27T10:28:54.000Z | 2020-03-15T10:44:37.000Z | server/app/api_1_0/__init__.py | ju1115kr/hash-brown | 93c5e636404608c7cba889cc9f9e0f3d3d0723b2 | [
"Apache-2.0"
] | 9 | 2018-06-27T10:29:37.000Z | 2021-12-13T19:48:39.000Z | server/app/api_1_0/__init__.py | ju1115kr/hash-brown | 93c5e636404608c7cba889cc9f9e0f3d3d0723b2 | [
"Apache-2.0"
] | 2 | 2018-07-04T16:54:20.000Z | 2018-07-04T16:58:36.000Z | # -*- coding: utf-8 -*-
from flask import Blueprint
from flask_cors import CORS
# Flask Blueprint 정의
api = Blueprint('api', __name__)
CORS(api) # enable CORS on the API_v1.0 blueprint
from . import errors,transaction,authentication, news, users, search, stars
| 26.3 | 75 | 0.745247 |
from flask import Blueprint
from flask_cors import CORS
api = Blueprint('api', __name__)
CORS(api)
from . import errors,transaction,authentication, news, users, search, stars
| true | true |
f74037e84f8c87dfd913a65204f4db50122a2ac5 | 14,058 | py | Python | builders/losses_builder_test.py | zhonglihanzhu/tensorflow-objectDetection | aa3d1b754d5c78b8401ce86d4c20f45741fc2b77 | [
"Apache-2.0"
] | 1 | 2019-04-24T16:32:11.000Z | 2019-04-24T16:32:11.000Z | builders/losses_builder_test.py | zhonglihanzhu/tensorflow-objectDetection | aa3d1b754d5c78b8401ce86d4c20f45741fc2b77 | [
"Apache-2.0"
] | null | null | null | builders/losses_builder_test.py | zhonglihanzhu/tensorflow-objectDetection | aa3d1b754d5c78b8401ce86d4c20f45741fc2b77 | [
"Apache-2.0"
] | 3 | 2018-04-04T07:26:54.000Z | 2020-08-14T01:43:29.000Z | # Copyright 2017 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... | 32.09589 | 80 | 0.669654 |
import tensorflow as tf
from google.protobuf import text_format
from builders import losses_builder
from core import losses
from protos import losses_pb2
class LocalizationLossBuilderTest(tf.test.TestCase):
def test_build_weighted_l2_localization_loss(self):
losses_text_proto = """
local... | true | true |
f74039d36a6ac73f98e7a7a22d1766feb916500b | 478 | py | Python | tests/test_internet_access.py | QwantResearch/idunn | 88b6862f1036187855b5541bbb6758ddd4df33c1 | [
"Apache-2.0"
] | 26 | 2018-11-30T09:17:17.000Z | 2020-11-07T01:53:07.000Z | tests/test_internet_access.py | QwantResearch/idunn | 88b6862f1036187855b5541bbb6758ddd4df33c1 | [
"Apache-2.0"
] | 38 | 2018-06-08T09:41:04.000Z | 2020-12-07T17:39:12.000Z | tests/test_internet_access.py | Qwant/idunn | 65582dfed732093778bf7c2998db1e2cd78255b8 | [
"Apache-2.0"
] | 9 | 2018-05-18T13:07:00.000Z | 2020-08-01T16:42:40.000Z | from idunn.blocks.services_and_information import InternetAccessBlock
def test_internet_access_block():
internet_access_block = InternetAccessBlock.from_es({"properties": {"wifi": "no"}}, lang="en")
assert internet_access_block is None
def test_internet_access_block_ok():
internet_access_block = Interne... | 34.142857 | 98 | 0.759414 | from idunn.blocks.services_and_information import InternetAccessBlock
def test_internet_access_block():
internet_access_block = InternetAccessBlock.from_es({"properties": {"wifi": "no"}}, lang="en")
assert internet_access_block is None
def test_internet_access_block_ok():
internet_access_block = Interne... | true | true |
f74039d779bab41005d35888cc4a33959399664d | 2,257 | py | Python | adv/aa.py | betairylia/dl | 4eb06837b13decc569066a43b58e205f3b716ff8 | [
"Apache-2.0"
] | null | null | null | adv/aa.py | betairylia/dl | 4eb06837b13decc569066a43b58e205f3b716ff8 | [
"Apache-2.0"
] | null | null | null | adv/aa.py | betairylia/dl | 4eb06837b13decc569066a43b58e205f3b716ff8 | [
"Apache-2.0"
] | null | null | null | import adv_test
from adv import *
from slot.a import *
import slot.a
def module():
return Mikoto
class Mikoto(Adv):
a1 = ('cc', 0.10, 'hp70')
a3 = ('cc', 0.08)
def init(this):
if this.condition('connect s1'):
this.s1_proc = this.c_s1_proc
def prerun(this):
this.... | 24.802198 | 77 | 0.489145 | import adv_test
from adv import *
from slot.a import *
import slot.a
def module():
return Mikoto
class Mikoto(Adv):
a1 = ('cc', 0.10, 'hp70')
a3 = ('cc', 0.08)
def init(this):
if this.condition('connect s1'):
this.s1_proc = this.c_s1_proc
def prerun(this):
this.... | true | true |
f7403ab5d8ecd44dc96a440ac65e221c9f1917f3 | 4,715 | py | Python | rqalpha/const.py | bttt123/rqalpha | 1e4c860363b89a2f574b61c73d21a57242d7f2e1 | [
"Apache-2.0"
] | 44 | 2017-06-17T09:43:17.000Z | 2022-03-02T11:08:03.000Z | rqalpha/const.py | hadrianl/rqalpha_kairui | eb0e0de1d69f1a4d6f349d4dc011e1c9eccfe2d8 | [
"Apache-2.0"
] | 2 | 2017-08-26T13:10:17.000Z | 2018-06-14T12:28:08.000Z | rqalpha/const.py | hadrianl/rqalpha_kairui | eb0e0de1d69f1a4d6f349d4dc011e1c9eccfe2d8 | [
"Apache-2.0"
] | 28 | 2017-06-26T10:06:29.000Z | 2021-12-17T04:26:04.000Z | # -*- coding: utf-8 -*-
#
# Copyright 2017 Ricequant, Inc
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | 24.056122 | 116 | 0.649841 |
from enum import Enum
class CustomEnum(Enum):
def __repr__(self):
return "%s.%s" % (
self.__class__.__name__, self._name_)
class EXECUTION_PHASE(CustomEnum):
GLOBAL = "[全局]"
ON_INIT = "[程序初始化]"
BEFORE_TRADING = "[日内交易前]"
ON_BAR = "[盘中 handle_bar 函数]"
ON_T... | true | true |
f7403af3f673762406695e8e74c4de7630e93320 | 1,837 | py | Python | proj files/path.py | ZhenoSan/DistributedFileSystem | 8776e0ecffcc06ea213603ad0ca202e15595297c | [
"MIT"
] | 1 | 2021-03-01T08:49:26.000Z | 2021-03-01T08:49:26.000Z | proj files/path.py | ZhenoSan/DistributedFileSystem | 8776e0ecffcc06ea213603ad0ca202e15595297c | [
"MIT"
] | null | null | null | proj files/path.py | ZhenoSan/DistributedFileSystem | 8776e0ecffcc06ea213603ad0ca202e15595297c | [
"MIT"
] | null | null | null | import os
strt = 'folder1/folder2/file3'
strt = 'folder1'
newl = strt.split('/')
print(newl)
'''
def list_files(startpath):
for root, dirs, files in os.walk(startpath):
level = root.replace(startpath, '').count(os.sep)
#print(level)
indent = ' ' * 4 * (level)
print('{}{}/'.format(i... | 21.869048 | 67 | 0.615678 | import os
strt = 'folder1/folder2/file3'
strt = 'folder1'
newl = strt.split('/')
print(newl)
| true | true |
f7403b6f16078156f4dd1e0f333e7adc8a3c422a | 5,987 | py | Python | src/utils.py | nicola144/auxiliary-particle-filters | 61d72e9163abb73007c0fbd30f68d4cc6d7ab4e9 | [
"MIT"
] | 5 | 2020-11-26T15:56:15.000Z | 2022-02-06T12:48:21.000Z | src/utils.py | nicola144/auxiliary-particle-filters | 61d72e9163abb73007c0fbd30f68d4cc6d7ab4e9 | [
"MIT"
] | null | null | null | src/utils.py | nicola144/auxiliary-particle-filters | 61d72e9163abb73007c0fbd30f68d4cc6d7ab4e9 | [
"MIT"
] | null | null | null | import re
import sys
import matplotlib.pyplot as plt
import numpy as np
from matplotlib import rcParams
from scipy.integrate import simps
from scipy.special import logsumexp
from scipy.optimize import minimize
# from sklearn.cluster import DBSCAN
# from sklearn.preprocessing import StandardScaler
import time
import ra... | 25.806034 | 98 | 0.683648 | import re
import sys
import matplotlib.pyplot as plt
import numpy as np
from matplotlib import rcParams
from scipy.integrate import simps
from scipy.special import logsumexp
from scipy.optimize import minimize
import time
import random
from tqdm import tqdm
def compute_cluster_centers(all_points):
all_points = S... | true | true |
f7403bb9d1c724f316feebfeb305cf8f490377a4 | 2,900 | py | Python | railrl/predictors/state_action_network.py | fredshentu/public_model_based_controller | 9301699bc56aa49ba5c699f7d5be299046a8aa0c | [
"MIT"
] | null | null | null | railrl/predictors/state_action_network.py | fredshentu/public_model_based_controller | 9301699bc56aa49ba5c699f7d5be299046a8aa0c | [
"MIT"
] | null | null | null | railrl/predictors/state_action_network.py | fredshentu/public_model_based_controller | 9301699bc56aa49ba5c699f7d5be299046a8aa0c | [
"MIT"
] | null | null | null | import abc
import tensorflow as tf
from railrl.core.neuralnet import NeuralNetwork
from rllab.misc.overrides import overrides
class StateActionNetwork(NeuralNetwork, metaclass=abc.ABCMeta):
"""
A map from (state, action) to a vector
"""
def __init__(
self,
name_or_scope,
... | 34.52381 | 73 | 0.593103 | import abc
import tensorflow as tf
from railrl.core.neuralnet import NeuralNetwork
from rllab.misc.overrides import overrides
class StateActionNetwork(NeuralNetwork, metaclass=abc.ABCMeta):
def __init__(
self,
name_or_scope,
output_dim,
env_spec=None,
... | true | true |
f7403bd30d604fb80212a777fdb215bee2cfe9bc | 290 | py | Python | python/exchange_two_nos.py | codevscolor/codevscolor | 35ef9042bdc86f45ef87795c35963b75fb64d5d7 | [
"Apache-2.0"
] | 6 | 2019-04-26T03:11:54.000Z | 2021-05-07T21:48:29.000Z | python/exchange_two_nos.py | akojif/codevscolor | 56db3dffeac8f8d76ff8fcf5656770f33765941f | [
"Apache-2.0"
] | null | null | null | python/exchange_two_nos.py | akojif/codevscolor | 56db3dffeac8f8d76ff8fcf5656770f33765941f | [
"Apache-2.0"
] | 26 | 2019-02-23T14:50:46.000Z | 2022-02-04T23:44:24.000Z | #1
first = int(input("Enter the value of the first number : "))
second = int(input("Enter the value of the second number : "))
#2
first = first + second
#3
second = first - second
#4
first = first - second
#5
print("After exchange, First number is : ",first," Second number is : ",second)
| 24.166667 | 79 | 0.675862 |
first = int(input("Enter the value of the first number : "))
second = int(input("Enter the value of the second number : "))
first = first + second
second = first - second
first = first - second
print("After exchange, First number is : ",first," Second number is : ",second)
| true | true |
f7403bdf2e7f20e422b388eaddd5aee64a579fa2 | 99 | py | Python | mindsdb/api/http/namespaces/configs/datasources.py | yarenty/mindsdb | 9164bca6f45fd0f5ec329babe973f286ffe59709 | [
"MIT"
] | 261 | 2018-09-28T02:32:17.000Z | 2018-12-10T06:30:54.000Z | mindsdb/api/http/namespaces/configs/datasources.py | yarenty/mindsdb | 9164bca6f45fd0f5ec329babe973f286ffe59709 | [
"MIT"
] | 27 | 2018-09-26T08:49:11.000Z | 2018-12-10T14:42:52.000Z | mindsdb/api/http/namespaces/configs/datasources.py | yarenty/mindsdb | 9164bca6f45fd0f5ec329babe973f286ffe59709 | [
"MIT"
] | 46 | 2018-10-06T10:11:18.000Z | 2018-12-10T04:02:17.000Z | from flask_restx import Namespace
ns_conf = Namespace('datasources', description='Data sources')
| 19.8 | 62 | 0.79798 | from flask_restx import Namespace
ns_conf = Namespace('datasources', description='Data sources')
| true | true |
f7403cce5dfeb204d5655bcd642b0e170028d73b | 256 | py | Python | .history/ClassFiles/Control Flow/For_20210101213904.py | minefarmer/Comprehensive-Python | f97b9b83ec328fc4e4815607e6a65de90bb8de66 | [
"Unlicense"
] | null | null | null | .history/ClassFiles/Control Flow/For_20210101213904.py | minefarmer/Comprehensive-Python | f97b9b83ec328fc4e4815607e6a65de90bb8de66 | [
"Unlicense"
] | null | null | null | .history/ClassFiles/Control Flow/For_20210101213904.py | minefarmer/Comprehensive-Python | f97b9b83ec328fc4e4815607e6a65de90bb8de66 | [
"Unlicense"
] | null | null | null | ''' For loop
Used to iterate over a sequence.
Sequence is usually: (list,tuple, dictionary,set,string)
Does not require an indexing variable to initiate the loop.
I can use break abd continue statements.
'''
fruits = ["grapes", "berrys", ] | 23.272727 | 59 | 0.695313 | fruits = ["grapes", "berrys", ] | true | true |
f7403ef77d6786dcb59806e84e2a8e4395e52f83 | 1,595 | py | Python | python/polypy/lib/word_algebra.py | amatveyakin/polykit | beb20059d9f90b8341e5ddf75543ab1f2168d1b4 | [
"MIT"
] | 1 | 2021-09-16T08:25:23.000Z | 2021-09-16T08:25:23.000Z | python/polypy/lib/word_algebra.py | amatveyakin/polykit | beb20059d9f90b8341e5ddf75543ab1f2168d1b4 | [
"MIT"
] | null | null | null | python/polypy/lib/word_algebra.py | amatveyakin/polykit | beb20059d9f90b8341e5ddf75543ab1f2168d1b4 | [
"MIT"
] | null | null | null | import re
from .delta import Inf, d_expr_dimension
from .linear import Linear
from .lyndon import to_lyndon_basis
from .util import get_one_item
def word_expr_weight(expr):
return len(get_one_item(expr.items())[0])
def word_expr_max_char(expr):
return max([max(word) for word, _ in expr.items()])
def words_... | 29.537037 | 74 | 0.677743 | import re
from .delta import Inf, d_expr_dimension
from .linear import Linear
from .lyndon import to_lyndon_basis
from .util import get_one_item
def word_expr_weight(expr):
return len(get_one_item(expr.items())[0])
def word_expr_max_char(expr):
return max([max(word) for word, _ in expr.items()])
def words_... | true | true |
f7403f2a0f66fcd26ffdf6876e78b0117f16e9ed | 44,632 | py | Python | cyberbrain/value_stack.py | sourcery-ai-bot/Cyberbrain | d3b65f073c4850f4ab677f07f7b832b93b896c9b | [
"MIT"
] | 2 | 2020-12-30T20:28:17.000Z | 2020-12-31T04:02:27.000Z | cyberbrain/value_stack.py | formazione/Cyberbrain | c135ee7879ef049e459e34be1756da8006430e24 | [
"MIT"
] | null | null | null | cyberbrain/value_stack.py | formazione/Cyberbrain | c135ee7879ef049e459e34be1756da8006430e24 | [
"MIT"
] | null | null | null | # encoding: utf-8
"""A self maintained value stack."""
from __future__ import annotations
import dataclasses
import enum
import functools
import inspect
import sys
from copy import copy
from dis import Instruction
from types import FrameType
from typing import Optional
try:
from typing import TYPE_CHECKING, Lit... | 36.583607 | 88 | 0.622199 |
from __future__ import annotations
import dataclasses
import enum
import functools
import inspect
import sys
from copy import copy
from dis import Instruction
from types import FrameType
from typing import Optional
try:
from typing import TYPE_CHECKING, Literal
except ImportError:
from typing_extensions im... | true | true |
f74040105130f4fd0ceedc2705d6a5fa569b3164 | 3,807 | py | Python | homeassistant/components/gstreamer/media_player.py | zalke/home-assistant | a31e49c857722c0723dc5297cd83cbce0f8716f6 | [
"Apache-2.0"
] | 4 | 2019-07-03T22:36:57.000Z | 2019-08-10T15:33:25.000Z | homeassistant/components/gstreamer/media_player.py | zalke/home-assistant | a31e49c857722c0723dc5297cd83cbce0f8716f6 | [
"Apache-2.0"
] | 7 | 2019-08-23T05:26:02.000Z | 2022-03-11T23:57:18.000Z | homeassistant/components/gstreamer/media_player.py | zalke/home-assistant | a31e49c857722c0723dc5297cd83cbce0f8716f6 | [
"Apache-2.0"
] | 3 | 2019-04-28T16:35:45.000Z | 2020-05-28T15:21:59.000Z | """Play media via gstreamer."""
import logging
import voluptuous as vol
from homeassistant.components.media_player import (
MediaPlayerDevice, PLATFORM_SCHEMA)
from homeassistant.components.media_player.const import (
MEDIA_TYPE_MUSIC, SUPPORT_NEXT_TRACK, SUPPORT_PAUSE,
SUPPORT_PLAY, SUPPORT_PLAY_MEDIA, S... | 27 | 79 | 0.651694 | import logging
import voluptuous as vol
from homeassistant.components.media_player import (
MediaPlayerDevice, PLATFORM_SCHEMA)
from homeassistant.components.media_player.const import (
MEDIA_TYPE_MUSIC, SUPPORT_NEXT_TRACK, SUPPORT_PAUSE,
SUPPORT_PLAY, SUPPORT_PLAY_MEDIA, SUPPORT_VOLUME_SET)
from homeassi... | true | true |
f740413c9f6699524d5b9d56f7e4f8a6c26b5cab | 1,420 | py | Python | portal/migrations/0009_auto_20170826_1647.py | nickmvincent/ugc-val-est | b5cceda14ef5830f1befaddfccfd90a694c9677a | [
"MIT"
] | 2 | 2019-11-13T19:56:05.000Z | 2020-09-05T03:21:14.000Z | portal/migrations/0009_auto_20170826_1647.py | nickmvincent/ugc-val-est | b5cceda14ef5830f1befaddfccfd90a694c9677a | [
"MIT"
] | 6 | 2018-03-02T16:49:20.000Z | 2021-06-10T18:55:02.000Z | portal/migrations/0009_auto_20170826_1647.py | nickmvincent/ugc-val-est | b5cceda14ef5830f1befaddfccfd90a694c9677a | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-08-26 16:47
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('portal', '0008_auto_20170825_1249'),
]
operations = [
migrations.AddField(
... | 30.869565 | 68 | 0.605634 |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('portal', '0008_auto_20170825_1249'),
]
operations = [
migrations.AddField(
model_name='sampledredditthread',
name='sample_... | true | true |
f7404150187df19b3e70c4af067f98c99fe1498d | 7,946 | py | Python | src/config.py | ubirch/ubirch-goclient-chirpstack-connector | b0ba68ac7a18d52a97aa1b9292b91f0d34993f07 | [
"Apache-2.0"
] | null | null | null | src/config.py | ubirch/ubirch-goclient-chirpstack-connector | b0ba68ac7a18d52a97aa1b9292b91f0d34993f07 | [
"Apache-2.0"
] | null | null | null | src/config.py | ubirch/ubirch-goclient-chirpstack-connector | b0ba68ac7a18d52a97aa1b9292b91f0d34993f07 | [
"Apache-2.0"
] | null | null | null | import os
import json
import shutil
import logging
from typing import Callable
class Config():
def __init__(self, configFile: str, log: logging.Logger):
""" init function of the Config class """
# set default values (None means that is has to be set)
self.configFile = configFile
self.log = log
s... | 43.659341 | 148 | 0.674427 | import os
import json
import shutil
import logging
from typing import Callable
class Config():
def __init__(self, configFile: str, log: logging.Logger):
self.configFile = configFile
self.log = log
self.config: dict = None
self.configFD = None
self.backupPath = self.configFile + ".backup"
... | true | true |
f7404183abd7066c7c542a5b75b491edf2b468ce | 1,009 | py | Python | jdcloud_sdk/services/cps/models/Ipv6AddressSpec.py | Tanc009/jdcloud-sdk-python | 8b045c99bc5b73ca7348e950b6f01e03a27982f5 | [
"Apache-2.0"
] | 14 | 2018-04-19T09:53:56.000Z | 2022-01-27T06:05:48.000Z | jdcloud_sdk/services/cps/models/Ipv6AddressSpec.py | Tanc009/jdcloud-sdk-python | 8b045c99bc5b73ca7348e950b6f01e03a27982f5 | [
"Apache-2.0"
] | 15 | 2018-09-11T05:39:54.000Z | 2021-07-02T12:38:02.000Z | jdcloud_sdk/services/cps/models/Ipv6AddressSpec.py | Tanc009/jdcloud-sdk-python | 8b045c99bc5b73ca7348e950b6f01e03a27982f5 | [
"Apache-2.0"
] | 33 | 2018-04-20T05:29:16.000Z | 2022-02-17T09:10:05.000Z | # coding=utf8
# Copyright 2018 JDCLOUD.COM
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... | 31.53125 | 75 | 0.70664 |
class Ipv6AddressSpec(object):
def __init__(self, bandwidth, ipv6Addresses, charge, ):
self.bandwidth = bandwidth
self.ipv6Addresses = ipv6Addresses
self.charge = charge
| true | true |
f74041d2619806f6a836172cf853cfdc24dc54ca | 3,106 | py | Python | xam/preprocessing/binning/mdlp.py | topolphukhanh/xam | 3fa958ba8b0c8e8e266cac9997b7a7d0c309f55c | [
"MIT"
] | 357 | 2017-03-23T19:07:31.000Z | 2022-03-11T09:08:07.000Z | xam/preprocessing/binning/mdlp.py | topolphukhanh/xam | 3fa958ba8b0c8e8e266cac9997b7a7d0c309f55c | [
"MIT"
] | 8 | 2018-07-05T09:18:36.000Z | 2022-03-04T05:10:09.000Z | xam/preprocessing/binning/mdlp.py | topolphukhanh/xam | 3fa958ba8b0c8e8e266cac9997b7a7d0c309f55c | [
"MIT"
] | 89 | 2017-03-24T22:12:39.000Z | 2022-02-14T15:47:41.000Z | """
Minimum Description Length Principle (MDLP) binning
- Original paper: http://sci2s.ugr.es/keel/pdf/algorithm/congreso/fayyad1993.pdf
- Implementation inspiration: https://www.ibm.com/support/knowledgecenter/it/SSLVMB_21.0.0/com.ibm.spss.statistics.help/alg_optimal-binning.htm
"""
import collections
import math
i... | 27.981982 | 143 | 0.67933 |
import collections
import math
import numpy as np
from scipy import stats
from sklearn.utils import check_X_y
from .base import BaseSupervisedBinner
class MDLPBinner(BaseSupervisedBinner):
def fit(self, X, y, **fit_params):
X, y = check_X_y(X, y, y_numeric=True)
self.cut_points_ = [mdlp_cut(... | true | true |
f740426344c2fdd9bd6bc200f900d8fc6c7d22c0 | 1,054 | py | Python | bin/AdaBoost.py | ezeddin/random_forest | 07a23af1764fbf7a54a27e79d5ac68c69a64f0b1 | [
"MIT"
] | null | null | null | bin/AdaBoost.py | ezeddin/random_forest | 07a23af1764fbf7a54a27e79d5ac68c69a64f0b1 | [
"MIT"
] | null | null | null | bin/AdaBoost.py | ezeddin/random_forest | 07a23af1764fbf7a54a27e79d5ac68c69a64f0b1 | [
"MIT"
] | null | null | null | from sklearn.ensemble import AdaBoostClassifier
from sklearn.tree import DecisionTreeClassifier
from sklearn.datasets import make_gaussian_quantiles
from sklearn.ensemble import RandomForestClassifier
def AdaBoost(X_train, y_train, X_test, DEPTH, N_ESTIMATORS):
# Create and fit an AdaBoosted decision tree
bdt = AdaB... | 35.133333 | 127 | 0.783681 | from sklearn.ensemble import AdaBoostClassifier
from sklearn.tree import DecisionTreeClassifier
from sklearn.datasets import make_gaussian_quantiles
from sklearn.ensemble import RandomForestClassifier
def AdaBoost(X_train, y_train, X_test, DEPTH, N_ESTIMATORS):
bdt = AdaBoostClassifier(DecisionTreeClassifier(max_de... | true | true |
f74044431f0156566f65e0435802f79bdfecfbff | 636 | py | Python | bin/rst2man.py | incognitoRepo/hdlogger | c738161ef3144469ba0f47caf89770613031e96e | [
"BSD-2-Clause"
] | null | null | null | bin/rst2man.py | incognitoRepo/hdlogger | c738161ef3144469ba0f47caf89770613031e96e | [
"BSD-2-Clause"
] | null | null | null | bin/rst2man.py | incognitoRepo/hdlogger | c738161ef3144469ba0f47caf89770613031e96e | [
"BSD-2-Clause"
] | null | null | null | #!/Users/alberthan/VSCodeProjects/hdlogger/bin/python3
# Author:
# Contact: grubert@users.sf.net
# Copyright: This module has been placed in the public domain.
"""
man.py
======
This module provides a simple command line interface that uses the
man page writer to output from ReStructuredText source.
"""
import loc... | 23.555556 | 80 | 0.773585 |
import locale
try:
locale.setlocale(locale.LC_ALL, '')
except:
pass
from docutils.core import publish_cmdline, default_description
from docutils.writers import manpage
description = ("Generates plain unix manual documents. " + default_description)
publish_cmdline(writer=manpage.Writer(), description=... | true | true |
f74044e4481aea62aaad532662124ba0432d6527 | 6,922 | py | Python | pipelines/cv_biobert_lstm_ft.py | BioSystemsUM/biotmpy | f981d58cf7f53a2aa09708e13d6561533c164e1f | [
"MIT"
] | 13 | 2021-11-02T11:10:56.000Z | 2022-02-23T11:48:20.000Z | pipelines/cv_biobert_lstm_ft.py | BioSystemsUM/biotmpy | f981d58cf7f53a2aa09708e13d6561533c164e1f | [
"MIT"
] | null | null | null | pipelines/cv_biobert_lstm_ft.py | BioSystemsUM/biotmpy | f981d58cf7f53a2aa09708e13d6561533c164e1f | [
"MIT"
] | null | null | null | model_name= 'cv_biobert_lstm_ft'
import sys
sys.path.append('../')
import os
import tensorflow
import numpy as np
import random
seed_value = 123123
#seed_value = None
environment_name = sys.executable.split('/')[-3]
print('Environment:', environment_name)
os.environ[environment_name] = str(seed_val... | 33.601942 | 152 | 0.746172 | model_name= 'cv_biobert_lstm_ft'
import sys
sys.path.append('../')
import os
import tensorflow
import numpy as np
import random
seed_value = 123123
environment_name = sys.executable.split('/')[-3]
print('Environment:', environment_name)
os.environ[environment_name] = str(seed_value)
np.random.se... | true | true |
f7404519c97593d29e968f26d7eafdd8f3f75b6b | 331 | py | Python | backend/messages.py | erickzhao/sobbing-rabbits | 27d295895aa72477fe942f680535bd142b82bf27 | [
"MIT"
] | 4 | 2019-03-17T16:02:49.000Z | 2020-11-06T02:46:03.000Z | backend/messages.py | erickzhao/sobbing-rabbits | 27d295895aa72477fe942f680535bd142b82bf27 | [
"MIT"
] | null | null | null | backend/messages.py | erickzhao/sobbing-rabbits | 27d295895aa72477fe942f680535bd142b82bf27 | [
"MIT"
] | null | null | null | from twilio.rest import Client
account = "ACeec37d10088b2826aa81746d709c57e3"
token = "e84982e1d3e37a080664f749f1027c0a"
client = Client(account, token)
def send_sms(number, body):
message = client.messages.create(to="+14383996776", from_="+1 778 654 6641",
body=body)
return m... | 27.583333 | 80 | 0.691843 | from twilio.rest import Client
account = "ACeec37d10088b2826aa81746d709c57e3"
token = "e84982e1d3e37a080664f749f1027c0a"
client = Client(account, token)
def send_sms(number, body):
message = client.messages.create(to="+14383996776", from_="+1 778 654 6641",
body=body)
return m... | true | true |
f74045d8500b549605f4ec378b475c401d1092c0 | 40,875 | py | Python | kilojoule/humidair.py | johnfmaddox/kilojoule | b4c146ded82e3ef51a0252ff48b1066a076e9aeb | [
"MIT"
] | null | null | null | kilojoule/humidair.py | johnfmaddox/kilojoule | b4c146ded82e3ef51a0252ff48b1066a076e9aeb | [
"MIT"
] | null | null | null | kilojoule/humidair.py | johnfmaddox/kilojoule | b4c146ded82e3ef51a0252ff48b1066a076e9aeb | [
"MIT"
] | null | null | null | from .units import Quantity, units
from .common import (
invert_dict,
CP_symbUpper_to_units,
preferred_units_from_type,
preferred_units_from_symbol,
)
from .realfluid import Properties as rfprop
from .plotting import PropertyPlot, plt
import CoolProp
from CoolProp.CoolProp import HAPropsSI,set_reference... | 39.340712 | 180 | 0.5703 | from .units import Quantity, units
from .common import (
invert_dict,
CP_symbUpper_to_units,
preferred_units_from_type,
preferred_units_from_symbol,
)
from .realfluid import Properties as rfprop
from .plotting import PropertyPlot, plt
import CoolProp
from CoolProp.CoolProp import HAPropsSI,set_reference... | true | true |
f74047ed40ca4a7b1dd28d1f5812a0b3d3b4d563 | 4,908 | py | Python | api/models.py | buzzlighter97/Ya.Praktikum_YamDB | 20550ad74eff7980026bfe6df3ffcd7db85b39ad | [
"MIT"
] | null | null | null | api/models.py | buzzlighter97/Ya.Praktikum_YamDB | 20550ad74eff7980026bfe6df3ffcd7db85b39ad | [
"MIT"
] | null | null | null | api/models.py | buzzlighter97/Ya.Praktikum_YamDB | 20550ad74eff7980026bfe6df3ffcd7db85b39ad | [
"MIT"
] | null | null | null | from datetime import datetime as dt
from django.contrib.auth import get_user_model
from django.core.validators import MaxValueValidator, MinValueValidator
from django.db import models
from django.utils.translation import gettext_lazy as _
User = get_user_model()
"""
MAX_YEARS_TITLES: this value indicates which year ... | 24.663317 | 76 | 0.582518 | from datetime import datetime as dt
from django.contrib.auth import get_user_model
from django.core.validators import MaxValueValidator, MinValueValidator
from django.db import models
from django.utils.translation import gettext_lazy as _
User = get_user_model()
MAX_YEARS_TITLES = dt.now().year + 10
class Categori... | true | true |
f74049f783086c0ac98aaa0e292f5ceb6913f665 | 7,087 | py | Python | scripts/mkdoc.py | DusanJovic-NOAA/ccpp-framework | c95101b40df4cf7109c3d34651792d89455690bf | [
"Apache-2.0"
] | null | null | null | scripts/mkdoc.py | DusanJovic-NOAA/ccpp-framework | c95101b40df4cf7109c3d34651792d89455690bf | [
"Apache-2.0"
] | null | null | null | scripts/mkdoc.py | DusanJovic-NOAA/ccpp-framework | c95101b40df4cf7109c3d34651792d89455690bf | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python3
#
# Functions to generate basic documentation in HTML and LaTeX for CCPP metadata
#
# DH* TODO: create a Python module metadata.py with a class Metadata
# and use this for ccpp_prebuild.py; create to_html and to_latex routines for it
import logging
import os
from common import decode_containe... | 39.814607 | 117 | 0.59461 |
import logging
import os
from common import decode_container, escape_tex
r = metadata_request[var_name][0]
line = '''
\hyperlink{{{standard_name_ref}}}{{\\blue\\underline{{\\execout{{{standard_name}}}}}}} \\\\'''.format(
standard_name=escape_tex(var.standard_name), standard_name_... | true | true |
f7404b2795ed88a6e9af36178538e8b71b5e757e | 851 | py | Python | Game/libs/debugconstants.py | Penaz91/Glitch_Heaven | 0363fc368af205d1e829b2556ad70797930c10bd | [
"MIT"
] | 1 | 2016-04-27T20:38:07.000Z | 2016-04-27T20:38:07.000Z | Game/libs/debugconstants.py | Penaz91/Glitch_Heaven | 0363fc368af205d1e829b2556ad70797930c10bd | [
"MIT"
] | 75 | 2015-10-22T06:10:37.000Z | 2018-09-16T17:02:34.000Z | Game/libs/debugconstants.py | Penaz91/Glitch_Heaven | 0363fc368af205d1e829b2556ad70797930c10bd | [
"MIT"
] | null | null | null | import pygame
_debugkeys_ = {
pygame.K_1: "wallClimb", pygame.K_2: "multiJump",
pygame.K_3: "highJump", pygame.K_4: "featherFalling",
pygame.K_5: "gravity", pygame.K_6: "hover",
pygame.K_7: "stickyCeil", pygame.K_8: "invertedGravity",
pygame.K_9: "permBodies", pygame.K_q: "solidH... | 50.058824 | 67 | 0.629847 | import pygame
_debugkeys_ = {
pygame.K_1: "wallClimb", pygame.K_2: "multiJump",
pygame.K_3: "highJump", pygame.K_4: "featherFalling",
pygame.K_5: "gravity", pygame.K_6: "hover",
pygame.K_7: "stickyCeil", pygame.K_8: "invertedGravity",
pygame.K_9: "permBodies", pygame.K_q: "solidH... | true | true |
f7404b670ea67ab4df11c410d6fd260ff116580d | 997 | py | Python | josephus_survivor.py | emreozturanli/Python-Questions-and-Answers | b24624cebeb571ddc6aa519f743a961fa34f19f6 | [
"MIT"
] | null | null | null | josephus_survivor.py | emreozturanli/Python-Questions-and-Answers | b24624cebeb571ddc6aa519f743a961fa34f19f6 | [
"MIT"
] | null | null | null | josephus_survivor.py | emreozturanli/Python-Questions-and-Answers | b24624cebeb571ddc6aa519f743a961fa34f19f6 | [
"MIT"
] | null | null | null | # ********JOSEPHUS SURVIVOR********
#codewars
# In this kata you have to correctly return who is the "survivor", ie: the last element of a Josephus permutation.
# Basically you have to assume that n people are put into a circle and that they are eliminated in steps of k elements, like this:
# josephus_survivor(7,3)... | 30.212121 | 130 | 0.564694 |
def josephus_survivor(n,k):
lst = list(range(1,n+1))
while len(lst) > 1 :
if len(lst) >= k :
lst = lst[k:] + lst[:k-1]
else:
i = (k % len(lst)) - 1
if i == -1:
lst = lst[:-1]
else:
lst = lst[i+1:... | true | true |
f7404bc5f6f77bff53711e5ce831e82713d3c90c | 3,174 | py | Python | tf_mnist.py | Dongzhou-1996/tf_learning | fe764e78cc1a934707ae01d0847f901cb6fbb8b9 | [
"Apache-2.0"
] | null | null | null | tf_mnist.py | Dongzhou-1996/tf_learning | fe764e78cc1a934707ae01d0847f901cb6fbb8b9 | [
"Apache-2.0"
] | null | null | null | tf_mnist.py | Dongzhou-1996/tf_learning | fe764e78cc1a934707ae01d0847f901cb6fbb8b9 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
# coding=utf-8
import tensorflow as tf
import os
import numpy as np
import argparse
import shutil
from tensorflow.examples.tutorials.mnist import input_data
parser = argparse.ArgumentParser('MNIST Softmax')
parser.add_argument('--data_dir', type=str, default='/tmp/mnist-data',
... | 44.704225 | 124 | 0.654379 |
import tensorflow as tf
import os
import numpy as np
import argparse
import shutil
from tensorflow.examples.tutorials.mnist import input_data
parser = argparse.ArgumentParser('MNIST Softmax')
parser.add_argument('--data_dir', type=str, default='/tmp/mnist-data',
help='the directory o... | true | true |
f7404c23f64fd4e0c0e77da03d4f8150735b2602 | 1,543 | py | Python | test/test_api_v1.py | s2t2/tweet-analyzer-py | 0a398fc47101a2d602d8c4116c970f1076a58f27 | [
"MIT"
] | 5 | 2020-04-02T12:03:57.000Z | 2020-10-18T19:29:15.000Z | test/test_api_v1.py | s2t2/tweet-analyzer-py | 0a398fc47101a2d602d8c4116c970f1076a58f27 | [
"MIT"
] | 22 | 2020-03-31T02:00:34.000Z | 2021-06-30T17:59:01.000Z | test/test_api_v1.py | s2t2/tweet-analyzer-py | 0a398fc47101a2d602d8c4116c970f1076a58f27 | [
"MIT"
] | 3 | 2020-04-04T16:08:08.000Z | 2020-10-20T01:32:46.000Z | import json
import pytest
from conftest import CI_ENV
@pytest.mark.skipif(CI_ENV, reason="avoid issuing HTTP requests on CI")
def test_user_tweets(api_client):
expected_keys = ['created_at', 'score_bert', 'score_lr', 'score_nb', 'status_id', 'status_text']
response = api_client.get('/api/v1/user_tweets/ber... | 39.564103 | 131 | 0.726507 | import json
import pytest
from conftest import CI_ENV
@pytest.mark.skipif(CI_ENV, reason="avoid issuing HTTP requests on CI")
def test_user_tweets(api_client):
expected_keys = ['created_at', 'score_bert', 'score_lr', 'score_nb', 'status_id', 'status_text']
response = api_client.get('/api/v1/user_tweets/ber... | true | true |
f7404c364bb3fcd0a888b8e151293dbc6fd3a3f2 | 15,525 | py | Python | venv/lib/python3.8/site-packages/plotly/validators/_violin.py | SvtFilatov/soccer-predict-prices | b003ebd7c3657688790183ef7d719c42290c11b9 | [
"MIT"
] | 76 | 2020-07-06T14:44:05.000Z | 2022-02-14T15:30:21.000Z | venv/lib/python3.8/site-packages/plotly/validators/_violin.py | SvtFilatov/soccer-predict-prices | b003ebd7c3657688790183ef7d719c42290c11b9 | [
"MIT"
] | 11 | 2020-08-09T02:30:14.000Z | 2022-03-12T00:50:14.000Z | venv/lib/python3.8/site-packages/plotly/validators/_violin.py | SvtFilatov/soccer-predict-prices | b003ebd7c3657688790183ef7d719c42290c11b9 | [
"MIT"
] | 11 | 2020-07-12T16:18:07.000Z | 2022-02-05T16:48:35.000Z | import _plotly_utils.basevalidators
class ViolinValidator(_plotly_utils.basevalidators.CompoundValidator):
def __init__(self, plotly_name="violin", parent_name="", **kwargs):
super(ViolinValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
data_c... | 48.667712 | 71 | 0.548792 | import _plotly_utils.basevalidators
class ViolinValidator(_plotly_utils.basevalidators.CompoundValidator):
def __init__(self, plotly_name="violin", parent_name="", **kwargs):
super(ViolinValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
data_c... | true | true |
f7404d7ea192880ab86e37acaeb02c70421f2853 | 1,502 | py | Python | src/cltkv1/stops/processes.py | todd-cook/cltkv1 | 90c3daaafda242a1982b38c2b11c52aedab7ddf8 | [
"MIT"
] | null | null | null | src/cltkv1/stops/processes.py | todd-cook/cltkv1 | 90c3daaafda242a1982b38c2b11c52aedab7ddf8 | [
"MIT"
] | null | null | null | src/cltkv1/stops/processes.py | todd-cook/cltkv1 | 90c3daaafda242a1982b38c2b11c52aedab7ddf8 | [
"MIT"
] | null | null | null | from dataclasses import dataclass
from boltons.cacheutils import cachedproperty
from boltons.strutils import split_punct_ws
from cltkv1.core.data_types import Process
from cltkv1.stops.words import Stops
@dataclass
class StopsProcess(Process):
"""
>>> from cltkv1.core.data_types import Doc, Word
>>> fr... | 31.957447 | 107 | 0.664447 | from dataclasses import dataclass
from boltons.cacheutils import cachedproperty
from boltons.strutils import split_punct_ws
from cltkv1.core.data_types import Process
from cltkv1.stops.words import Stops
@dataclass
class StopsProcess(Process):
language: str = None
@cachedproperty
def algorithm(self):
... | true | true |
f7404d966e2999ccfcb232dc74d8d591fcf06803 | 595 | py | Python | tests/test_http_pipeline.py | Poorvak/http_pipeline | 2e5711c3f44bb88e55eaae6dbf888d2ff626f997 | [
"CC-BY-3.0",
"MIT"
] | null | null | null | tests/test_http_pipeline.py | Poorvak/http_pipeline | 2e5711c3f44bb88e55eaae6dbf888d2ff626f997 | [
"CC-BY-3.0",
"MIT"
] | 633 | 2018-02-05T00:02:14.000Z | 2022-03-28T05:38:30.000Z | tests/test_http_pipeline.py | Poorvak/http_pipeline | 2e5711c3f44bb88e55eaae6dbf888d2ff626f997 | [
"CC-BY-3.0",
"MIT"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for `http_pipeline` package."""
import pytest
from http_pipeline import http_pipeline
@pytest.fixture
def response():
"""Sample pytest fixture.
See more at: http://doc.pytest.org/en/latest/fixture.html
"""
# import requests
# return reque... | 22.884615 | 78 | 0.704202 |
import pytest
from http_pipeline import http_pipeline
@pytest.fixture
def response():
def test_content(response):
| true | true |
f7404dd23bdb552dd96e5b0f86101c724fd9da4e | 6,793 | py | Python | dnn/loss.py | MalayAgr/DeepNeuralNetworksFromScratch | ded75b148d9bb497014c016bfd2d7d0280c007ab | [
"MIT"
] | 4 | 2021-08-01T19:18:42.000Z | 2022-01-09T01:16:26.000Z | dnn/loss.py | MalayAgr/DeepNeuralNetworksFromScratch | ded75b148d9bb497014c016bfd2d7d0280c007ab | [
"MIT"
] | null | null | null | dnn/loss.py | MalayAgr/DeepNeuralNetworksFromScratch | ded75b148d9bb497014c016bfd2d7d0280c007ab | [
"MIT"
] | null | null | null | from __future__ import annotations
from abc import ABC, abstractmethod
import numpy as np
from numba import njit
@njit(cache=True)
def _clip(a: np.ndarray, epsilon: float) -> np.ndarray:
if ((a == 1) | (a <= 0)).any():
a = np.maximum(a, epsilon).astype(np.float32)
a = np.minimum(1 - epsilon, a).... | 29.663755 | 92 | 0.629619 | from __future__ import annotations
from abc import ABC, abstractmethod
import numpy as np
from numba import njit
@njit(cache=True)
def _clip(a: np.ndarray, epsilon: float) -> np.ndarray:
if ((a == 1) | (a <= 0)).any():
a = np.maximum(a, epsilon).astype(np.float32)
a = np.minimum(1 - epsilon, a).... | true | true |
f7404fe473b756e941478f7613628a96fa8f59b5 | 4,097 | py | Python | Battle_Of_Two_K/my_class.py | Battle-Of-Two-K/NumericalMethods | 88fe581fe4cb4d5e676f368e9de562f99c324674 | [
"MIT"
] | null | null | null | Battle_Of_Two_K/my_class.py | Battle-Of-Two-K/NumericalMethods | 88fe581fe4cb4d5e676f368e9de562f99c324674 | [
"MIT"
] | null | null | null | Battle_Of_Two_K/my_class.py | Battle-Of-Two-K/NumericalMethods | 88fe581fe4cb4d5e676f368e9de562f99c324674 | [
"MIT"
] | null | null | null | import copy
class My_matrix:
def __init__(self, matrix):
self.matrix = matrix
def __str__(self):
out = f'{self.matrix_size}\n'
for row in self.matrix:
out += str(row) + '\n'
return out
def null_matrix(self):
return [[0 for i in self.range_row()] for j ... | 26.953947 | 94 | 0.508177 | import copy
class My_matrix:
def __init__(self, matrix):
self.matrix = matrix
def __str__(self):
out = f'{self.matrix_size}\n'
for row in self.matrix:
out += str(row) + '\n'
return out
def null_matrix(self):
return [[0 for i in self.range_row()] for j ... | true | true |
f740506fdd4d745bc85979159f4277704a5920e5 | 14,985 | py | Python | third_party/py/gflags/gflags/_helpers.py | timm-gs/bazel | d16012774f97d8a3d0f7732e116dba8ab636a4cb | [
"Apache-2.0"
] | 17 | 2017-10-25T05:39:49.000Z | 2021-03-03T07:32:13.000Z | third_party/py/gflags/gflags/_helpers.py | timm-gs/bazel | d16012774f97d8a3d0f7732e116dba8ab636a4cb | [
"Apache-2.0"
] | null | null | null | third_party/py/gflags/gflags/_helpers.py | timm-gs/bazel | d16012774f97d8a3d0f7732e116dba8ab636a4cb | [
"Apache-2.0"
] | 6 | 2018-02-13T06:55:59.000Z | 2019-05-26T15:24:45.000Z | #!/usr/bin/env python
# Copyright 2002 Google Inc. All Rights Reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of c... | 34.767981 | 100 | 0.701702 |
import collections
import os
import re
import struct
import sys
import textwrap
try:
import fcntl
except ImportError:
fcntl = None
try:
import termios
except ImportError:
termios = None
import third_party.pep257 as pep257
import six
_DEFAULT_HELP_WIDTH = 80
_MIN_HELP_... | true | true |
f7405098b1ce59a39682290c2e92850cdd8441fd | 56,362 | py | Python | Lib/test/test_array.py | devnexen/RustPython | 345a4f912c83ce723fc859ab934c17ffe3f2b57a | [
"CC-BY-4.0",
"MIT"
] | 2 | 2021-09-03T16:15:06.000Z | 2021-09-03T16:19:28.000Z | Lib/test/test_array.py | devnexen/RustPython | 345a4f912c83ce723fc859ab934c17ffe3f2b57a | [
"CC-BY-4.0",
"MIT"
] | 6 | 2021-10-01T13:51:43.000Z | 2021-11-17T13:27:14.000Z | Lib/test/test_array.py | devnexen/RustPython | 345a4f912c83ce723fc859ab934c17ffe3f2b57a | [
"CC-BY-4.0",
"MIT"
] | 1 | 2020-08-04T12:13:42.000Z | 2020-08-04T12:13:42.000Z | """Test the arraymodule.
Roger E. Masse
"""
import unittest
from test import support
from test.support import _2G, os_helper
import weakref
import pickle
import operator
import struct
import sys
import warnings
import array
from array import _array_reconstructor as array_reconstructor
sizeof_wchar = array.array('... | 34.055589 | 92 | 0.576009 |
import unittest
from test import support
from test.support import _2G, os_helper
import weakref
import pickle
import operator
import struct
import sys
import warnings
import array
from array import _array_reconstructor as array_reconstructor
sizeof_wchar = array.array('u').itemsize
class ArraySubclass(array.array)... | true | true |
f74051fd7306d34e53f50db8c91666f44b3ca8f7 | 3,624 | py | Python | src/screen.py | QuentinBubu/trophees-nsi-2022 | 3402b584de7b07b54b6e97332d279f670efe48c2 | [
"MIT"
] | null | null | null | src/screen.py | QuentinBubu/trophees-nsi-2022 | 3402b584de7b07b54b6e97332d279f670efe48c2 | [
"MIT"
] | 2 | 2022-03-01T10:51:46.000Z | 2022-03-15T19:51:18.000Z | src/screen.py | QuentinBubu/trophees-nsi-2022 | 3402b584de7b07b54b6e97332d279f670efe48c2 | [
"MIT"
] | 1 | 2022-03-29T17:02:17.000Z | 2022-03-29T17:02:17.000Z | import pygame
from pygameSettings import afficher_text
class Screen:
WAITING = 'waiting'
PROLOGUE = 'prologue'
MAIN = 'main'
sprites = pygame.sprite.Group()
on_screen = {}
def __init__(self) -> None:
"""Initialisation classe Screen pour gerer l'affichage
Arguments : screen ... | 32.070796 | 93 | 0.548565 | import pygame
from pygameSettings import afficher_text
class Screen:
WAITING = 'waiting'
PROLOGUE = 'prologue'
MAIN = 'main'
sprites = pygame.sprite.Group()
on_screen = {}
def __init__(self) -> None:
pygame.init()
self.screen = pygame.display.set_mode((1280, 720), pygame.RES... | true | true |
f7405214feb2748d30e6cb0e66454d75f42ee019 | 1,353 | py | Python | DatastructureAndAlgorithms/4_ArrayAndString/10_maximum_index.py | sabyasachisome/DatastructureAndAlgorithms | 5c810bc1b1f31a856d9331673305c0021453c572 | [
"MIT"
] | null | null | null | DatastructureAndAlgorithms/4_ArrayAndString/10_maximum_index.py | sabyasachisome/DatastructureAndAlgorithms | 5c810bc1b1f31a856d9331673305c0021453c572 | [
"MIT"
] | null | null | null | DatastructureAndAlgorithms/4_ArrayAndString/10_maximum_index.py | sabyasachisome/DatastructureAndAlgorithms | 5c810bc1b1f31a856d9331673305c0021453c572 | [
"MIT"
] | null | null | null | """
Given an array A[] of N positive integers.
The task is to find the maximum of j - i subjected to the constraint of A[i] <= A[j].
Example 1:
Input:
N = 2
A[] = {1, 10}
Output:
1
Explanation:
A[0]<=A[1] so (j-i) is 1-0 = 1.
Example 2:
Input:
N = 9
A[] = {34, 8, 10, 3, 2, 80, 30, 33, 1}
Output:
6
Explanation:
In t... | 24.160714 | 101 | 0.601626 |
class Solution:
def maxIndexDiff(self, arr, n):
max_diff=0
for i in range(n):
j=n-1
while(j>i):
if arr[i]<arr[j] and j-i>max_diff:
max_diff=j-i
j-=1
return max_diff
... | true | true |
f740525eb8f615afc79833efbc9820348da5b5fb | 6,127 | py | Python | unlock/bci/decode/__init__.py | NeuralProsthesisLab/unlock | 0c4d95abdab288d3e657ca2db867b06f755f26ff | [
"BSD-3-Clause"
] | 6 | 2017-05-05T01:08:55.000Z | 2021-08-03T21:50:07.000Z | unlock/bci/decode/__init__.py | NeuralProsthesisLab/unlock | 0c4d95abdab288d3e657ca2db867b06f755f26ff | [
"BSD-3-Clause"
] | 1 | 2015-05-21T01:02:50.000Z | 2015-05-21T16:03:43.000Z | unlock/bci/decode/__init__.py | NeuralProsthesisLab/unlock | 0c4d95abdab288d3e657ca2db867b06f755f26ff | [
"BSD-3-Clause"
] | 4 | 2015-05-21T12:38:42.000Z | 2022-03-28T15:47:58.000Z | # Copyright (c) James Percent, Byron Galbraith and Unlock contributors.
# 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 notic... | 46.067669 | 99 | 0.699853 |
import numpy as np
from unlock.bci.decode.decode import *
from unlock.bci.decode.harmonic import *
from unlock.bci.decode.femg import *
from unlock.bci.decode.eyeblink import *
from unlock.bci.decode.tm import *
class UnlockDecoderFactory(object):
def create_decoder(self, decoder, *... | true | true |
f74052fc75149623c53807a92dbaed0dc80b21ed | 398 | py | Python | missions/Road To Centurion/1.2 Brain Teaser.py | thecnoNSMB/ktane-mission-solver | 237d969a8acd21533b5fb18cc5a47dd03ba1cc7d | [
"MIT"
] | 1 | 2022-01-04T03:47:34.000Z | 2022-01-04T03:47:34.000Z | missions/Road To Centurion/1.2 Brain Teaser.py | thecnoNSMB/ktane-mission-solver | 237d969a8acd21533b5fb18cc5a47dd03ba1cc7d | [
"MIT"
] | 4 | 2021-04-13T07:03:37.000Z | 2021-12-15T11:34:05.000Z | missions/Road To Centurion/1.2 Brain Teaser.py | thecnoNSMB/ktane-mission-solver | 237d969a8acd21533b5fb18cc5a47dd03ba1cc7d | [
"MIT"
] | null | null | null | from ktane.directors import BombSolver, from_pool
from ktane.mods.c import ColourFlash
from ktane.vanilla import (ComplicatedWires, Memory, WhosOnFirst, WireSequence,
Password, Wires, TheButton, Keypad)
BombSolver(
ColourFlash(),
ComplicatedWires(),
*from_pool(Memory, WhosOnFirst... | 33.166667 | 79 | 0.718593 | from ktane.directors import BombSolver, from_pool
from ktane.mods.c import ColourFlash
from ktane.vanilla import (ComplicatedWires, Memory, WhosOnFirst, WireSequence,
Password, Wires, TheButton, Keypad)
BombSolver(
ColourFlash(),
ComplicatedWires(),
*from_pool(Memory, WhosOnFirst... | true | true |
f7405322518a66f963b74f15aa3f85fb9446b57c | 1,187 | py | Python | build/lib/Quantuiti/_ema.py | dmuraco3/CompuTradePython | 5c2bc4d1d3baabd68677b8c3d78b8caeed52ba28 | [
"Apache-2.0"
] | null | null | null | build/lib/Quantuiti/_ema.py | dmuraco3/CompuTradePython | 5c2bc4d1d3baabd68677b8c3d78b8caeed52ba28 | [
"Apache-2.0"
] | null | null | null | build/lib/Quantuiti/_ema.py | dmuraco3/CompuTradePython | 5c2bc4d1d3baabd68677b8c3d78b8caeed52ba28 | [
"Apache-2.0"
] | null | null | null | import numpy as np
def ema(self, N):
"""
Simple Moving Average = (N - PeriodSum) / N
N = number of days in a given period
PeriodSum = sum of stock closing prices in that period
"""
name = 'ema_' + str(N)
dependent = 'sma_' + str(N)
try:
return self.data[name][self.index]
... | 33.914286 | 129 | 0.47936 | import numpy as np
def ema(self, N):
name = 'ema_' + str(N)
dependent = 'sma_' + str(N)
try:
return self.data[name][self.index]
except Exception as error:
self.sma(N)
print(self.data.head())
temp=[]
for index, row in self.data.iterrows():
... | true | true |
f74053718f0bd617347898c99e1841d104fae1cd | 33,191 | py | Python | tests/core/full_node/test_full_node_store.py | 13thProgression/lotus-blockchain | ea6d1973cac256bc0dae790a23aac3fe6925dd4e | [
"Apache-2.0"
] | 4 | 2021-08-24T19:43:33.000Z | 2022-02-09T04:29:56.000Z | tests/core/full_node/test_full_node_store.py | 13thProgression/lotus-blockchain | ea6d1973cac256bc0dae790a23aac3fe6925dd4e | [
"Apache-2.0"
] | 5 | 2021-08-24T22:55:58.000Z | 2022-01-11T11:44:04.000Z | tests/core/full_node/test_full_node_store.py | 13thProgression/lotus-blockchain | ea6d1973cac256bc0dae790a23aac3fe6925dd4e | [
"Apache-2.0"
] | 3 | 2021-09-10T17:13:31.000Z | 2022-03-15T08:47:21.000Z | # flake8: noqa: F811, F401
import asyncio
import atexit
import logging
from secrets import token_bytes
from typing import List, Optional
import pytest
from lotus.consensus.blockchain import ReceiveBlockResult
from lotus.consensus.multiprocess_validation import PreValidationResult
from lotus.consensus.pot_iterations i... | 44.551678 | 120 | 0.625742 |
import asyncio
import atexit
import logging
from secrets import token_bytes
from typing import List, Optional
import pytest
from lotus.consensus.blockchain import ReceiveBlockResult
from lotus.consensus.multiprocess_validation import PreValidationResult
from lotus.consensus.pot_iterations import is_overflow_block
fr... | true | true |
f74053c382947a53aed43ff4529eb3fe7e80aa5a | 657 | py | Python | openpipe/actions/transform/using/regex/assign_.py | OpenPipe/openpipe | bf00bafc1d9240459dd26873141074b89b53d36f | [
"Apache-2.0"
] | 2 | 2021-01-28T15:33:15.000Z | 2022-03-09T10:20:27.000Z | openpipe/actions/transform/using/regex/assign_.py | Openpipe/openpipe | bf00bafc1d9240459dd26873141074b89b53d36f | [
"Apache-2.0"
] | 35 | 2019-03-22T10:49:21.000Z | 2019-11-29T09:23:47.000Z | openpipe/actions/transform/using/regex/assign_.py | OpenPipe/openpipe | bf00bafc1d9240459dd26873141074b89b53d36f | [
"Apache-2.0"
] | 1 | 2022-01-26T22:08:40.000Z | 2022-01-26T22:08:40.000Z | """
Build a dictionary from a key/map regex group expression
"""
from openpipe.pipeline.engine import ActionRuntime
from re import compile, MULTILINE
class Action(ActionRuntime):
category = "Data Transformation"
required_config = """
regex: # A regex expression that must match two groups:
... | 25.269231 | 64 | 0.637747 | from openpipe.pipeline.engine import ActionRuntime
from re import compile, MULTILINE
class Action(ActionRuntime):
category = "Data Transformation"
required_config = """
regex: # A regex expression that must match two groups:
# (group1) (group2)
"""
def on_start(self, config... | true | true |
f74054611ccea3131676d187a7213d70f3e899ce | 3,790 | py | Python | 2018/07/solution.py | jrm5100/advent-of-code-python | 1f448ef0b87bb305814444d1b7f865493d455104 | [
"MIT"
] | null | null | null | 2018/07/solution.py | jrm5100/advent-of-code-python | 1f448ef0b87bb305814444d1b7f865493d455104 | [
"MIT"
] | null | null | null | 2018/07/solution.py | jrm5100/advent-of-code-python | 1f448ef0b87bb305814444d1b7f865493d455104 | [
"MIT"
] | null | null | null | #!/usr/bin/python3
##############
# Load input #
##############
def load_input():
incomplete_steps = set() # incomplete steps, initalized to all steps
requirements = dict() # map steps to the required steps that must be completed first
with open("input.txt", "r") as f:
for line in f:
... | 39.479167 | 141 | 0.637467 |
prerequisite = line.split(' ')[1]
incomplete_steps.add(step)
incomplete_steps.add(prerequisite)
if step not in requirements:
requirements[step] = set(prerequisite)
else:
requirements[step].add(prerequisite)
ret... | true | true |
f7405464ab07406c3df5c9951266c75251015f9c | 3,195 | py | Python | bilstm_crf_ner/model/ner_model.py | rufinob/ehr-relation-extraction | d23e38a08de8c08e1d2de3f840b65fbbb4b61d8c | [
"MIT"
] | 43 | 2020-12-02T11:04:38.000Z | 2022-03-28T15:07:06.000Z | bilstm_crf_ner/model/ner_model.py | rufinob/ehr-relation-extraction | d23e38a08de8c08e1d2de3f840b65fbbb4b61d8c | [
"MIT"
] | 17 | 2021-05-05T00:19:17.000Z | 2022-03-17T03:14:58.000Z | bilstm_crf_ner/model/ner_model.py | rufinob/ehr-relation-extraction | d23e38a08de8c08e1d2de3f840b65fbbb4b61d8c | [
"MIT"
] | 23 | 2020-11-12T00:03:19.000Z | 2022-03-16T10:32:30.000Z | #from fastai.text import *
from .core import *
class NERModel(nn.Module):
def __init__(self, config):
super().__init__()
self.config = config
self.use_elmo = config.use_elmo
if not self.use_elmo:
self.emb = nn.Embedding(self.config.nwords, self.config.dim_word, padding... | 38.963415 | 170 | 0.620344 |
from .core import *
class NERModel(nn.Module):
def __init__(self, config):
super().__init__()
self.config = config
self.use_elmo = config.use_elmo
if not self.use_elmo:
self.emb = nn.Embedding(self.config.nwords, self.config.dim_word, padding_idx=0)
self.c... | true | true |
f7405486c3624f6b83c8bc901bb14c3dfe91a78f | 30,533 | py | Python | pytext/metrics/__init__.py | debowin/pytext | 91126bb34bd689f3513f25ca0d356ad374e004ab | [
"BSD-3-Clause"
] | 3 | 2019-10-19T11:16:12.000Z | 2021-11-17T11:09:00.000Z | pytext/metrics/__init__.py | debowin/pytext | 91126bb34bd689f3513f25ca0d356ad374e004ab | [
"BSD-3-Clause"
] | null | null | null | pytext/metrics/__init__.py | debowin/pytext | 91126bb34bd689f3513f25ca0d356ad374e004ab | [
"BSD-3-Clause"
] | null | null | null | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import itertools
from collections import defaultdict
from json import dumps as json_dumps
from typing import (
Any,
DefaultDict,
Dict,
List,
NamedTuple,
Optional,
Sequence,
Tuple,
Union,
)
... | 33.552747 | 107 | 0.628566 |
import itertools
from collections import defaultdict
from json import dumps as json_dumps
from typing import (
Any,
DefaultDict,
Dict,
List,
NamedTuple,
Optional,
Sequence,
Tuple,
Union,
)
import numpy as np
from pytext.utils import cuda
from pytext.utils.ascii_table import ascii... | true | true |
f74054c4d8a41d781697ed54e9f0b9c765213d5b | 3,726 | py | Python | core/domain/email_jobs_one_off_test.py | netajik/oppia | d3780352d615db7438e010c5aa5eb60588bb7de6 | [
"Apache-2.0"
] | 1 | 2019-01-31T18:48:50.000Z | 2019-01-31T18:48:50.000Z | core/domain/email_jobs_one_off_test.py | netajik/oppia | d3780352d615db7438e010c5aa5eb60588bb7de6 | [
"Apache-2.0"
] | 1 | 2020-01-26T14:02:43.000Z | 2020-01-26T14:02:43.000Z | core/domain/email_jobs_one_off_test.py | netajik/oppia | d3780352d615db7438e010c5aa5eb60588bb7de6 | [
"Apache-2.0"
] | null | null | null | # coding: utf-8
#
# Copyright 2014 The Oppia 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 requi... | 38.412371 | 79 | 0.672571 |
import datetime
import types
from core.domain import email_jobs_one_off
from core.platform import models
from core.tests import test_utils
import feconf
(email_models,) = models.Registry.import_models([models.NAMES.email])
taskqueue_services = models.Registry.import_taskqueue_services()
class Emai... | true | true |
f74055af35e039ceebef9de681ea52a4fa3c2126 | 3,712 | py | Python | web-server/code/03-handlers/server-index-page.py | choosewhatulike/500lines | fba689d101eb5600f5c8f4d7fd79912498e950e2 | [
"CC-BY-3.0"
] | 26,185 | 2015-01-01T04:59:51.000Z | 2022-03-31T10:20:14.000Z | web-server/code/03-handlers/server-index-page.py | fsxchen/500lines | 3f2cd407ebedaf0a3cfa6858c4cf94543067433d | [
"CC-BY-3.0"
] | 160 | 2015-01-05T12:20:21.000Z | 2021-10-03T07:25:43.000Z | web-server/code/03-handlers/server-index-page.py | fsxchen/500lines | 3f2cd407ebedaf0a3cfa6858c4cf94543067433d | [
"CC-BY-3.0"
] | 6,572 | 2015-01-01T01:31:00.000Z | 2022-03-31T07:31:22.000Z | import sys, os, BaseHTTPServer
#-------------------------------------------------------------------------------
class ServerException(Exception):
'''For internal error reporting.'''
pass
#-------------------------------------------------------------------------------
class case_no_file(object):
'''File ... | 29.696 | 80 | 0.515356 | import sys, os, BaseHTTPServer
class ServerException(Exception):
pass
class case_no_file(object):
def test(self, handler):
return not os.path.exists(handler.full_path)
def act(self, handler):
raise ServerException("'{0}' not found".format(handler.path))
class case_existing_file(ob... | true | true |
f74055b0459ce41641901d5d89c293885fa8a12a | 8,580 | py | Python | scripts/label_image_flask.py | Seb-Park/tensorflow-for-poets-2 | 1ef4112553b25f1c687b40b6872d4a97b9d44762 | [
"Apache-2.0"
] | null | null | null | scripts/label_image_flask.py | Seb-Park/tensorflow-for-poets-2 | 1ef4112553b25f1c687b40b6872d4a97b9d44762 | [
"Apache-2.0"
] | null | null | null | scripts/label_image_flask.py | Seb-Park/tensorflow-for-poets-2 | 1ef4112553b25f1c687b40b6872d4a97b9d44762 | [
"Apache-2.0"
] | null | null | null | # Copyright 2017 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... | 38.648649 | 137 | 0.675058 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import json
from flask import Flask, escape, request, jsonify
import argparse
import sys
import time
import numpy as np
import requests
import tensorflow as tf
app = Flask(__name__)
@app.rout... | true | true |
f74055ee4dbc3bfd6ba72d5c47385140d0c1accf | 8,884 | py | Python | indy_common/test/test_transactions.py | Rob-S/indy-node | 0aefbda62c5a7412d7e03b2fb9795c500ea67e9f | [
"Apache-2.0"
] | 627 | 2017-07-06T12:38:08.000Z | 2022-03-30T13:18:43.000Z | indy_common/test/test_transactions.py | Rob-S/indy-node | 0aefbda62c5a7412d7e03b2fb9795c500ea67e9f | [
"Apache-2.0"
] | 580 | 2017-06-29T17:59:57.000Z | 2022-03-29T21:37:52.000Z | indy_common/test/test_transactions.py | Rob-S/indy-node | 0aefbda62c5a7412d7e03b2fb9795c500ea67e9f | [
"Apache-2.0"
] | 704 | 2017-06-29T17:45:34.000Z | 2022-03-30T07:08:58.000Z | from indy_common.constants import NYM, NODE, ATTRIB, SCHEMA, CLAIM_DEF, DISCLO, GET_ATTR, GET_NYM, GET_TXNS, \
GET_SCHEMA, GET_CLAIM_DEF, POOL_UPGRADE, NODE_UPGRADE, \
POOL_CONFIG, REVOC_REG_DEF, REVOC_REG_ENTRY, \
GET_REVOC_REG_DEF, GET_REVOC_REG, GET_REVOC_REG_DELTA, POOL_RESTART, VALIDATOR_INFO, CHANGE_K... | 51.953216 | 115 | 0.77769 | from indy_common.constants import NYM, NODE, ATTRIB, SCHEMA, CLAIM_DEF, DISCLO, GET_ATTR, GET_NYM, GET_TXNS, \
GET_SCHEMA, GET_CLAIM_DEF, POOL_UPGRADE, NODE_UPGRADE, \
POOL_CONFIG, REVOC_REG_DEF, REVOC_REG_ENTRY, \
GET_REVOC_REG_DEF, GET_REVOC_REG, GET_REVOC_REG_DELTA, POOL_RESTART, VALIDATOR_INFO, CHANGE_K... | true | true |
f74056511be51a217aa65c0a8bd8a7837e4919eb | 351 | py | Python | test/datasets/test_transforms.py | pvrancx/torch_isr | 831278ae5c3b939b4147bae1a99bc3f3d4fc415d | [
"MIT"
] | null | null | null | test/datasets/test_transforms.py | pvrancx/torch_isr | 831278ae5c3b939b4147bae1a99bc3f3d4fc415d | [
"MIT"
] | null | null | null | test/datasets/test_transforms.py | pvrancx/torch_isr | 831278ae5c3b939b4147bae1a99bc3f3d4fc415d | [
"MIT"
] | null | null | null | import pytest
from isr.datasets.transforms import ChannelSelect
@pytest.mark.parametrize("channel_idx", [0, 1, 2])
def test_channel_select(pil_img, channel_idx: int):
transform = ChannelSelect(channel_idx)
channels = pil_img.split()
output = transform(pil_img)
assert output.mode == "L"
assert c... | 23.4 | 51 | 0.732194 | import pytest
from isr.datasets.transforms import ChannelSelect
@pytest.mark.parametrize("channel_idx", [0, 1, 2])
def test_channel_select(pil_img, channel_idx: int):
transform = ChannelSelect(channel_idx)
channels = pil_img.split()
output = transform(pil_img)
assert output.mode == "L"
assert c... | true | true |
f74056d2999ed5ea5e9e83f224dcb7a1cf267dec | 1,225 | py | Python | functests/helpers/func_test_helpers.py | jwdashel/woms | f326fabd1c3aae0fd4d678ecbcf5e2c59911cbbd | [
"BSD-3-Clause"
] | null | null | null | functests/helpers/func_test_helpers.py | jwdashel/woms | f326fabd1c3aae0fd4d678ecbcf5e2c59911cbbd | [
"BSD-3-Clause"
] | null | null | null | functests/helpers/func_test_helpers.py | jwdashel/woms | f326fabd1c3aae0fd4d678ecbcf5e2c59911cbbd | [
"BSD-3-Clause"
] | null | null | null | import sys
offset = "\t\t"
woms_keys = {
"title": "title",
"composer": "composer",
"mm_uid": "mm-uid"
}
def assert_and_report(element, one, another):
print(f"{offset} asserting that {element} is {one} ...")
try:
assert one == another
print(f"{offset}\u2713 {one} is {element}!")
... | 33.108108 | 75 | 0.718367 | import sys
offset = "\t\t"
woms_keys = {
"title": "title",
"composer": "composer",
"mm_uid": "mm-uid"
}
def assert_and_report(element, one, another):
print(f"{offset} asserting that {element} is {one} ...")
try:
assert one == another
print(f"{offset}\u2713 {one} is {element}!")
... | true | true |
f74056e213ef23d29688422b24d4df6f5fa87221 | 383 | py | Python | Aula 06/AdicionandoElementosArray.py | eduardojpsena/EstruturaDeDados-Python-IESP | 97c22fc1411dfdae2d1085e9a3ca0c334ee07988 | [
"MIT"
] | null | null | null | Aula 06/AdicionandoElementosArray.py | eduardojpsena/EstruturaDeDados-Python-IESP | 97c22fc1411dfdae2d1085e9a3ca0c334ee07988 | [
"MIT"
] | null | null | null | Aula 06/AdicionandoElementosArray.py | eduardojpsena/EstruturaDeDados-Python-IESP | 97c22fc1411dfdae2d1085e9a3ca0c334ee07988 | [
"MIT"
] | null | null | null | print("--- ADICIONANDO ELEMENTOS EM UM ARRAY ---")
def main():
registro = []
while True:
valores = str(input("Digite algo para adcionar a lista: "))
registro.append(valores)
condição = str(input("Deseja continuar? [S/N] ")).strip().upper()[0]
if condição in 'N':
bre... | 27.357143 | 76 | 0.582245 | print("--- ADICIONANDO ELEMENTOS EM UM ARRAY ---")
def main():
registro = []
while True:
valores = str(input("Digite algo para adcionar a lista: "))
registro.append(valores)
condição = str(input("Deseja continuar? [S/N] ")).strip().upper()[0]
if condição in 'N':
bre... | true | true |
f74057876c9b2fd16ed2dca3ee9a5d8d6a926360 | 17,699 | py | Python | utils/Quaternions.py | sanweiliti/HMP | 3d1a96ec86a72396349daa9f8dde9b2e5a3fc578 | [
"MIT"
] | 92 | 2021-08-25T01:23:36.000Z | 2022-03-20T02:29:55.000Z | NN/data/motion/Quaternions.py | lcyzgdy/GraduationProject-PFNN | abb37a553c9ebeccf746225331bd90ccc0e33df9 | [
"MIT"
] | 9 | 2021-10-14T11:54:01.000Z | 2022-03-13T17:45:37.000Z | NN/data/motion/Quaternions.py | lcyzgdy/GraduationProject-PFNN | abb37a553c9ebeccf746225331bd90ccc0e33df9 | [
"MIT"
] | 12 | 2021-08-25T01:49:43.000Z | 2022-03-16T13:46:13.000Z | import numpy as np
class Quaternions:
"""
Quaternions is a wrapper around a numpy ndarray
that allows it to act as if it were an narray of
a quaternion data type.
Therefore addition, subtraction, multiplication,
division, negation, absolute, are all defined
in terms of quater... | 37.818376 | 121 | 0.471157 | import numpy as np
class Quaternions:
def __init__(self, qs):
if isinstance(qs, np.ndarray):
if len(qs.shape) == 1: qs = np.array([qs])
self.qs = qs
return
if isinstance(qs, Quaternions):
self.qs = qs.qs
... | true | true |
f74058e160a9bcf64c14da9fc4d47871126d8b2f | 778 | py | Python | pornhub/entry/channel.py | LaudateCorpus1/pornhub-dl | ded5d5ce82d816544d400ead68b2d3eb0100e81b | [
"MIT"
] | 204 | 2019-03-28T00:40:55.000Z | 2022-03-31T23:25:59.000Z | pornhub/entry/channel.py | Inncee81/pornhub-dl-1 | ded5d5ce82d816544d400ead68b2d3eb0100e81b | [
"MIT"
] | 15 | 2019-05-01T20:01:20.000Z | 2022-03-17T22:29:51.000Z | pornhub/entry/channel.py | Inncee81/pornhub-dl-1 | ded5d5ce82d816544d400ead68b2d3eb0100e81b | [
"MIT"
] | 40 | 2019-04-07T20:06:05.000Z | 2022-03-29T18:59:56.000Z | from datetime import datetime
import click
from pornhub.core import get_session
from pornhub.extractors import download_channel_videos, get_channel_info
from pornhub.models import Channel
@click.command(name="channel")
@click.argument("name")
def get_channel(name: str) -> None:
"""Download a specific channel.
... | 27.785714 | 72 | 0.722365 | from datetime import datetime
import click
from pornhub.core import get_session
from pornhub.extractors import download_channel_videos, get_channel_info
from pornhub.models import Channel
@click.command(name="channel")
@click.argument("name")
def get_channel(name: str) -> None:
session = get_session()
chan... | true | true |
f74059c1f759b7f9d7034dbc25408e2f6768fd39 | 6,851 | py | Python | src/gluonts/nursery/tsbench/src/tsbench/surrogate/deepset.py | RingoIngo/gluon-ts | 62fb20c36025fc969653accaffaa783671709564 | [
"Apache-2.0"
] | 1 | 2022-03-28T01:17:00.000Z | 2022-03-28T01:17:00.000Z | src/gluonts/nursery/tsbench/src/tsbench/surrogate/deepset.py | RingoIngo/gluon-ts | 62fb20c36025fc969653accaffaa783671709564 | [
"Apache-2.0"
] | null | null | null | src/gluonts/nursery/tsbench/src/tsbench/surrogate/deepset.py | RingoIngo/gluon-ts | 62fb20c36025fc969653accaffaa783671709564 | [
"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... | 38.706215 | 99 | 0.646475 |
from typing import cast, List, Literal, Optional
import numpy as np
import numpy.typing as npt
import pytorch_lightning as pl
import torch
from lightkit.data import DataLoader
from torch import nn
from torch.utils.data import TensorDataset
from tsbench.config import Config, EnsembleConfig
from tsbench.eval... | true | true |
f7405aca876088f9dd2150aa791d233b606a8a83 | 5,484 | py | Python | les12/modularsecret.py | abreens/sn | 0da9e23a464436be6a3f2fb7f070838a613b0f5a | [
"MIT"
] | null | null | null | les12/modularsecret.py | abreens/sn | 0da9e23a464436be6a3f2fb7f070838a613b0f5a | [
"MIT"
] | 3 | 2019-10-07T15:28:57.000Z | 2019-10-14T23:07:31.000Z | les12/modularsecret.py | abreens/sn | 0da9e23a464436be6a3f2fb7f070838a613b0f5a | [
"MIT"
] | null | null | null | #####
#
# Les 12 - Make the "Guess the secret number" game more modular
#
# Use functions to make the game more modular. Also try to add another while loop so the user can play
# many rounds of the game without having to re-run the program each time.
#
# You can let the user choose the level of the game: 'Easy' of 'Har... | 33.644172 | 110 | 0.588257 |
random
import json
import datetime
def lees_geheel(upper_limit):
while True:
invoer = input("\nGeef een getal (tussen 1 en " + str(upper_limit) + "): ")
try:
getal = int(invoer)
except ValueError:
print("Jammer genoeg was dit geen (geheel) getal. Probeer aub opni... | true | true |
f7405b26f971953af9b26eafb9d62c5d9862f5e6 | 1,013 | py | Python | vimiv/exceptions.py | karlch/vimiv | acbb83e003805e5304131be1f73d7f66528606d6 | [
"MIT"
] | 268 | 2015-11-15T22:41:27.000Z | 2022-02-07T21:54:52.000Z | vimiv/exceptions.py | karlch/vimiv | acbb83e003805e5304131be1f73d7f66528606d6 | [
"MIT"
] | 92 | 2015-12-12T00:35:54.000Z | 2021-04-26T16:16:30.000Z | vimiv/exceptions.py | karlch/vimiv | acbb83e003805e5304131be1f73d7f66528606d6 | [
"MIT"
] | 15 | 2015-12-11T19:42:15.000Z | 2020-09-24T13:00:36.000Z | # vim: ft=python fileencoding=utf-8 sw=4 et sts=4
"""Contains custom exceptions used by vimiv."""
class NoSearchResultsError(Exception):
"""Raised when a search result is accessed although there are no results."""
class StringConversionError(ValueError):
"""Raised when a setting or argument could not be con... | 25.974359 | 80 | 0.727542 |
class NoSearchResultsError(Exception):
class StringConversionError(ValueError):
class SettingNotFoundError(Exception):
class NotABoolean(Exception):
class NotANumber(Exception):
class AliasError(Exception):
class TrashUndeleteError(Exception):
class NotTransformable(Exception):
class ArgumentAmountEr... | true | true |
f7405d1b42037cf682fd50862edbc5f0debc789e | 6,795 | py | Python | preprocessing/MaskRCNN/MaskRCNN_TUM.py | Wayne-Mai/DynSLAM | 7b62e13d2a33ff58ca888a346433a4891a228a20 | [
"BSD-3-Clause"
] | null | null | null | preprocessing/MaskRCNN/MaskRCNN_TUM.py | Wayne-Mai/DynSLAM | 7b62e13d2a33ff58ca888a346433a4891a228a20 | [
"BSD-3-Clause"
] | null | null | null | preprocessing/MaskRCNN/MaskRCNN_TUM.py | Wayne-Mai/DynSLAM | 7b62e13d2a33ff58ca888a346433a4891a228a20 | [
"BSD-3-Clause"
] | null | null | null | #!/usr/bin/env python3
#
# This file is part of https://github.com/martinruenz/maskfusion
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option)... | 37.75 | 137 | 0.675644 |
import sys
import os
mask_rcnn_path = os.path.abspath("../Mask_RCNN")
sys.path.insert(0, mask_rcnn_path)
import random
import math
import numpy as np
import scipy.misc
import matplotlib
import matplotlib.pyplot as plt
import argparse
from samples.coco import coco
from mrcnn import utils
from mrcnn ... | true | true |
f7405d8b131b0f923bce41ed1ab11c436b42d591 | 10,558 | py | Python | docs/sphinx_extensions/dfhack/changelog.py | Arson00/dfhack | fc384fd1a2bee65315fe79831a55ca74c8e6717b | [
"CC-BY-3.0"
] | 926 | 2015-01-02T13:06:12.000Z | 2022-03-24T13:22:26.000Z | docs/sphinx_extensions/dfhack/changelog.py | Arson00/dfhack | fc384fd1a2bee65315fe79831a55ca74c8e6717b | [
"CC-BY-3.0"
] | 1,238 | 2015-01-01T00:11:23.000Z | 2022-03-31T23:05:32.000Z | docs/sphinx_extensions/dfhack/changelog.py | Arson00/dfhack | fc384fd1a2bee65315fe79831a55ca74c8e6717b | [
"CC-BY-3.0"
] | 318 | 2015-01-03T16:35:50.000Z | 2022-03-31T00:22:01.000Z | import collections
import copy
import itertools
import os
import sys
from sphinx.errors import ExtensionError, SphinxError, SphinxWarning
from dfhack.util import DFHACK_ROOT, DOCS_ROOT
CHANGELOG_PATHS = (
'docs/changelog.txt',
'scripts/changelog.txt',
'library/xml/changelog.txt',
)
CHANGELOG_PATHS = (os.... | 34.730263 | 89 | 0.545937 | import collections
import copy
import itertools
import os
import sys
from sphinx.errors import ExtensionError, SphinxError, SphinxWarning
from dfhack.util import DFHACK_ROOT, DOCS_ROOT
CHANGELOG_PATHS = (
'docs/changelog.txt',
'scripts/changelog.txt',
'library/xml/changelog.txt',
)
CHANGELOG_PATHS = (os.... | true | true |
f7405db7123016b7a8f0e1d8452b7b1738e6374e | 762 | py | Python | src/data_management/corpus_for_context2vec.py | joaquimgomez/BachelorThesis-TextSimilarityMeasures | a5efd4d651c53f7e35cab05e8408ebf769f5aadf | [
"MIT"
] | null | null | null | src/data_management/corpus_for_context2vec.py | joaquimgomez/BachelorThesis-TextSimilarityMeasures | a5efd4d651c53f7e35cab05e8408ebf769f5aadf | [
"MIT"
] | null | null | null | src/data_management/corpus_for_context2vec.py | joaquimgomez/BachelorThesis-TextSimilarityMeasures | a5efd4d651c53f7e35cab05e8408ebf769f5aadf | [
"MIT"
] | null | null | null | import argparse
from os import listdir, mkdir
from os.path import isfile, join
from nltk import sent_tokenize
def main(org, dest):
with open(org, 'r') as o:
corpus = o.read()
sent_corpus = sent_tokenize(corpus)
with open(dest, 'w') as d:
for sent in sent_corpus:
d.write(sent + '\n')
if __name__ == "__m... | 29.307692 | 105 | 0.686352 | import argparse
from os import listdir, mkdir
from os.path import isfile, join
from nltk import sent_tokenize
def main(org, dest):
with open(org, 'r') as o:
corpus = o.read()
sent_corpus = sent_tokenize(corpus)
with open(dest, 'w') as d:
for sent in sent_corpus:
d.write(sent + '\n')
if __name__ == "__m... | true | true |
f7405e34e7549ce69644fe380a87bd075ba374c3 | 500 | py | Python | dashboard/spotify_main_app.py | Mega-Barrel/spotify_analysis | 8cc48f7fcaec195518872cb5b8429e3bcf03ebbf | [
"MIT"
] | 1 | 2021-12-26T15:35:05.000Z | 2021-12-26T15:35:05.000Z | dashboard/spotify_main_app.py | Mega-Barrel/spotify_analysis | 8cc48f7fcaec195518872cb5b8429e3bcf03ebbf | [
"MIT"
] | null | null | null | dashboard/spotify_main_app.py | Mega-Barrel/spotify_analysis | 8cc48f7fcaec195518872cb5b8429e3bcf03ebbf | [
"MIT"
] | null | null | null | # Main dashboard screen
# importing libraries
import dash
from dash import dcc
from dash import html
from dash.dependencies import Input, Output, State
# dash app
app = dash.Dash(__name__)
# Dash layout
app.layout = html.Div(
children=[
html.H1(
children='Spotify Analysis'
),
... | 17.857143 | 50 | 0.602 |
import dash
from dash import dcc
from dash import html
from dash.dependencies import Input, Output, State
app = dash.Dash(__name__)
app.layout = html.Div(
children=[
html.H1(
children='Spotify Analysis'
),
html.Div(
children='''
Dashboard for songs... | true | true |
f7405f6efbff415e1704f438a5b36046e2ea5f73 | 77,311 | py | Python | tests/v2/test_0224-arrow-to-awkward.py | jpivarski/awkward-1.0 | 49a3ff13ef90b8778a80573211d58c544729eaa5 | [
"BSD-3-Clause"
] | 2 | 2019-09-12T03:07:23.000Z | 2019-09-27T05:32:07.000Z | tests/v2/test_0224-arrow-to-awkward.py | jpivarski/awkward-1.0 | 49a3ff13ef90b8778a80573211d58c544729eaa5 | [
"BSD-3-Clause"
] | 1 | 2019-09-26T17:57:45.000Z | 2019-09-26T17:57:45.000Z | tests/v2/test_0224-arrow-to-awkward.py | jpivarski/awkward-1.0 | 49a3ff13ef90b8778a80573211d58c544729eaa5 | [
"BSD-3-Clause"
] | null | null | null | # BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE
import pytest # noqa: F401
import numpy as np # noqa: F401
import awkward as ak # noqa: F401
pyarrow = pytest.importorskip("pyarrow")
pytest.importorskip("awkward._v2._connect.pyarrow")
to_list = ak._v2.operations.to_list
de... | 32.648226 | 94 | 0.473387 |
import pytest
import numpy as np
import awkward as ak
pyarrow = pytest.importorskip("pyarrow")
pytest.importorskip("awkward._v2._connect.pyarrow")
to_list = ak._v2.operations.to_list
def test_toarrow_BitMaskedArray():
content = ak._v2.highlevel.Array(
["one", "two", "three", "four", "five", "six... | true | true |
f7405fa518f9b880306d5582a05a900e0fe44aa7 | 5,886 | py | Python | scripts/stampede/diff_machine_log_rule_keys_test.py | isfaaghyth/buck | cad8f7ac2de2c9a4f08ce66180db677e44d61aee | [
"Apache-2.0"
] | 2 | 2019-09-22T05:33:37.000Z | 2019-09-22T06:36:24.000Z | scripts/stampede/diff_machine_log_rule_keys_test.py | isfaaghyth/buck | cad8f7ac2de2c9a4f08ce66180db677e44d61aee | [
"Apache-2.0"
] | null | null | null | scripts/stampede/diff_machine_log_rule_keys_test.py | isfaaghyth/buck | cad8f7ac2de2c9a4f08ce66180db677e44d61aee | [
"Apache-2.0"
] | null | null | null | # Copyright 2018-present Facebook, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... | 35.672727 | 84 | 0.633028 |
import os
import unittest
import diff_machine_log_rule_keys as rule_key_differ
from diff_machine_log_rule_keys import DEFAULT_RULE_KEY, INPUT_RULE_KEY
def get_test_dir(test_dir):
this_dir = os.path.dirname(os.path.realpath(__file__))
return os.path.join(this_dir, "testdata", test_dir)
class T... | true | true |
f7406041853c8313000eb6da7c803c6cfbf9dd51 | 1,487 | py | Python | resnet/official/utils/logs/cloud_lib_test.py | biolins/frivolous_dnns | 23d9a057ac517770cdfe9d8ac71543c328fcf76d | [
"MIT"
] | 1 | 2021-05-17T01:42:29.000Z | 2021-05-17T01:42:29.000Z | official/utils/logs/cloud_lib_test.py | jdavidagudelo/tensorflow-models | 6f019beec73b01861363bf717706e27f4210b979 | [
"Apache-2.0"
] | null | null | null | official/utils/logs/cloud_lib_test.py | jdavidagudelo/tensorflow-models | 6f019beec73b01861363bf717706e27f4210b979 | [
"Apache-2.0"
] | 2 | 2021-05-31T23:08:13.000Z | 2021-12-28T19:11:08.000Z | # Copyright 2017 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... | 30.346939 | 80 | 0.710155 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import unittest
import mock
import requests
from official.utils.logs import cloud_lib
class CloudLibTest(unittest.TestCase):
@mock.patch("requests.get")
def test_on_gcp(self, mock_r... | true | true |
f74060c1de71240f9718b12324bf4e301a79653a | 8,680 | py | Python | python/infinoted.py | speedyleion/vobby | 7369afb52184358130dd4143a2a19e4c1dbb7ecf | [
"Unlicense"
] | null | null | null | python/infinoted.py | speedyleion/vobby | 7369afb52184358130dd4143a2a19e4c1dbb7ecf | [
"Unlicense"
] | null | null | null | python/infinoted.py | speedyleion/vobby | 7369afb52184358130dd4143a2a19e4c1dbb7ecf | [
"Unlicense"
] | null | null | null | """
This handles the communication to an infinoted server
"""
from twisted.internet import reactor
from twisted.internet.defer import Deferred
from twisted.names.srvconnect import SRVConnector
from twisted.words.xish import domish
from twisted.words.protocols.jabber import xmlstream, client
from twisted.words.protocol... | 38.070175 | 90 | 0.574539 |
from twisted.internet import reactor
from twisted.internet.defer import Deferred
from twisted.names.srvconnect import SRVConnector
from twisted.words.xish import domish
from twisted.words.protocols.jabber import xmlstream, client
from twisted.words.protocols.jabber.jid import JID
from twisted.words.protocols.jabber.sa... | true | true |
f7406225dfee59c79c27a2de9850dcf8c9432964 | 351 | py | Python | applications/DEMApplication/DEMApplication.py | HubertBalcerzak/Kratos | c15689d53f06dabb36dc44c13eeac73d3e183916 | [
"BSD-4-Clause"
] | null | null | null | applications/DEMApplication/DEMApplication.py | HubertBalcerzak/Kratos | c15689d53f06dabb36dc44c13eeac73d3e183916 | [
"BSD-4-Clause"
] | null | null | null | applications/DEMApplication/DEMApplication.py | HubertBalcerzak/Kratos | c15689d53f06dabb36dc44c13eeac73d3e183916 | [
"BSD-4-Clause"
] | null | null | null | from __future__ import print_function, absolute_import, division #makes KratosMultiphysics backward compatible with python 2.6 and 2.7
from KratosDEMApplication import *
from KratosMultiphysics import _ImportApplication
application = KratosDEMApplication()
application_name = "KratosDEMApplication"
_ImportApplication(... | 39 | 134 | 0.863248 | from __future__ import print_function, absolute_import, division
from KratosDEMApplication import *
from KratosMultiphysics import _ImportApplication
application = KratosDEMApplication()
application_name = "KratosDEMApplication"
_ImportApplication(application, application_name)
| true | true |
f74063724c532a90b8fe454df280bd34fbbc81f0 | 8,355 | py | Python | third_party/WebKit/Source/devtools/PRESUBMIT.py | Wzzzx/chromium-crosswalk | 768dde8efa71169f1c1113ca6ef322f1e8c9e7de | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 2 | 2019-01-28T08:09:58.000Z | 2021-11-15T15:32:10.000Z | third_party/WebKit/Source/devtools/PRESUBMIT.py | Wzzzx/chromium-crosswalk | 768dde8efa71169f1c1113ca6ef322f1e8c9e7de | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | null | null | null | third_party/WebKit/Source/devtools/PRESUBMIT.py | Wzzzx/chromium-crosswalk | 768dde8efa71169f1c1113ca6ef322f1e8c9e7de | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 6 | 2020-09-23T08:56:12.000Z | 2021-11-18T03:40:49.000Z | # Copyright (C) 2014 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the ... | 50.331325 | 155 | 0.735727 |
import sys
compile_note = "Be sure to run your patch by the compile_frontend.py script prior to committing!"
def _CheckDevtoolsStyle(input_api, output_api):
local_paths = [f.AbsoluteLocalPath() for f in input_api.AffectedFiles() if f.Action() != "D"]
devtools_root = input_api.Pr... | true | true |
f74063bc03f89b1d2a11dfd8032608a3b22b9622 | 8,029 | py | Python | docs/conf.py | cjwatson/zope.configuration | 24d5808a53c55112145f176912f6ace1b7061b98 | [
"ZPL-2.1"
] | null | null | null | docs/conf.py | cjwatson/zope.configuration | 24d5808a53c55112145f176912f6ace1b7061b98 | [
"ZPL-2.1"
] | null | null | null | docs/conf.py | cjwatson/zope.configuration | 24d5808a53c55112145f176912f6ace1b7061b98 | [
"ZPL-2.1"
] | null | null | null | # -*- coding: utf-8 -*-
#
# zope.configuration documentation build configuration file, created by
# sphinx-quickstart on Sat May 5 13:59:34 2012.
#
# 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
# autogenerated fi... | 32.24498 | 92 | 0.71715 |
import sys, os
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.doctest',
'sphinx.ext.todo',
'sphinx.ext.viewcode',
'repoze.sphinx.autointerface',
]
templates_path = ['_templates']
source_suffix = '.rst'
master_doc = 'index'
project = u'zope.configuration'
copyri... | true | true |
f74064d308efa4b861fec2b996dfb9c04769b387 | 56,010 | py | Python | caffe2/python/data_parallel_model_test.py | wenhaopeter/read_pytorch_code | 491f989cd918cf08874dd4f671fb7f0142a0bc4f | [
"Intel",
"X11"
] | null | null | null | caffe2/python/data_parallel_model_test.py | wenhaopeter/read_pytorch_code | 491f989cd918cf08874dd4f671fb7f0142a0bc4f | [
"Intel",
"X11"
] | null | null | null | caffe2/python/data_parallel_model_test.py | wenhaopeter/read_pytorch_code | 491f989cd918cf08874dd4f671fb7f0142a0bc4f | [
"Intel",
"X11"
] | null | null | null | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from future.utils import viewkeys
from multiprocessing import Process, Queue
import numpy as np
import os
import shutil
import tempfile
import unittest
import time
from mock import Mock
from hypothesis import a... | 39.388186 | 174 | 0.556829 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from future.utils import viewkeys
from multiprocessing import Process, Queue
import numpy as np
import os
import shutil
import tempfile
import unittest
import time
from mock import Mock
from hypothesis import a... | true | true |
f740653ddfcac2c4284824f0764681afd28fa43e | 8,530 | py | Python | numba_dppy/spirv_generator.py | akharche/numba-dppy | f12dac64b149bd72f305f341ff64b796bbb648c1 | [
"Apache-2.0"
] | null | null | null | numba_dppy/spirv_generator.py | akharche/numba-dppy | f12dac64b149bd72f305f341ff64b796bbb648c1 | [
"Apache-2.0"
] | null | null | null | numba_dppy/spirv_generator.py | akharche/numba-dppy | f12dac64b149bd72f305f341ff64b796bbb648c1 | [
"Apache-2.0"
] | null | null | null | # Copyright 2021 Intel Corporation
#
# 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 wr... | 31.018182 | 77 | 0.582181 |
import os
import shutil
import tempfile
from subprocess import CalledProcessError, check_call
from numba_dppy import config
from numba_dppy.target import LINK_ATOMIC, LLVM_SPIRV_ARGS
def _raise_bad_env_path(msg, path, extra=None):
error_message = msg.format(path)
if extra is not None:
... | true | true |
f7406573d0f8e639e82ec6f3bc90d07a3d09e38b | 4,700 | py | Python | XiaocaiCrawler/XiaocaiCrawler/settings.py | XiaocaiFintech/FundCrawler | 3a12ca1e6b6194a5a94cdee0782a37db198ada33 | [
"MIT"
] | null | null | null | XiaocaiCrawler/XiaocaiCrawler/settings.py | XiaocaiFintech/FundCrawler | 3a12ca1e6b6194a5a94cdee0782a37db198ada33 | [
"MIT"
] | null | null | null | XiaocaiCrawler/XiaocaiCrawler/settings.py | XiaocaiFintech/FundCrawler | 3a12ca1e6b6194a5a94cdee0782a37db198ada33 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# Scrapy settings for XiaocaiCrawler project
#
# For simplicity, this file contains only settings considered important or
# commonly used. You can find more settings consulting the documentation:
#
# http://doc.scrapy.org/en/latest/topics/settings.html
# http://scrapy.readthedocs.org/en... | 33.571429 | 109 | 0.774894 |
BOT_NAME = 'XiaocaiCrawler'
SPIDER_MODULES = ['XiaocaiCrawler.spiders']
NEWSPIDER_MODULE = 'XiaocaiCrawler.spiders'
ROBOTSTXT_OBEY = True
Y = 3
COOKIES_ENABLED = False
= {
'XiaocaiCrawler.contrib.downloadmiddleware.rotate_useragent.RotateUse... | true | true |
f7406864141ab40b34366fdc02f27120e324b62c | 8,857 | py | Python | tests/benchmark/milvus_benchmark/runners/utils.py | AropJoe/milvus | 132b3c2248c50e96a4edde56aefb43659a270837 | [
"Apache-2.0"
] | 2 | 2021-09-05T15:00:49.000Z | 2022-01-05T06:42:23.000Z | tests/benchmark/milvus_benchmark/runners/utils.py | AropJoe/milvus | 132b3c2248c50e96a4edde56aefb43659a270837 | [
"Apache-2.0"
] | 38 | 2021-11-22T11:15:27.000Z | 2022-03-30T08:14:12.000Z | tests/benchmark/milvus_benchmark/runners/utils.py | Bennu-Li/milvus | 35612881e33ce19a7407628769f6b51a7518bfe9 | [
"Apache-2.0"
] | 3 | 2021-11-17T09:21:42.000Z | 2021-11-22T11:54:09.000Z | import os
import logging
import numpy as np
import sklearn.preprocessing
import h5py
import random
from itertools import product
from pymilvus import DataType
from milvus_benchmark import config
logger = logging.getLogger("milvus_benchmark.runners.utils")
DELETE_INTERVAL_TIME = 2
VECTORS_PER_FILE = 1000000
SIFT_VEC... | 31.859712 | 109 | 0.657559 | import os
import logging
import numpy as np
import sklearn.preprocessing
import h5py
import random
from itertools import product
from pymilvus import DataType
from milvus_benchmark import config
logger = logging.getLogger("milvus_benchmark.runners.utils")
DELETE_INTERVAL_TIME = 2
VECTORS_PER_FILE = 1000000
SIFT_VEC... | true | true |
f740689002a21202a1640b8ad785796340a6cb62 | 619 | py | Python | Requests/auth_finished.py | derek-hoogewerf/Libraries | ecca0aafee9699097b1b142e745b612e9498d9ab | [
"MIT"
] | null | null | null | Requests/auth_finished.py | derek-hoogewerf/Libraries | ecca0aafee9699097b1b142e745b612e9498d9ab | [
"MIT"
] | null | null | null | Requests/auth_finished.py | derek-hoogewerf/Libraries | ecca0aafee9699097b1b142e745b612e9498d9ab | [
"MIT"
] | null | null | null | # Python Essential Libraries by Joe Marini course example
# Example file for the Requests library
import requests
from requests.auth import HTTPDigestAuth
# define user and password values
user = "theuser"
passwd = "thepass"
# TODO: use the basic authentication method
url = "https://httpbin.org/basic-auth/theusr/thep... | 29.47619 | 60 | 0.77706 |
import requests
from requests.auth import HTTPDigestAuth
user = "theuser"
passwd = "thepass"
url = "https://httpbin.org/basic-auth/theusr/thepas"
resp = requests.get(url, auth=(user, passwd))
print(resp.status_code)
print(resp.text)
url = "https://httpbin.org/digest-auth/auth/theuser/thepass"
resp = requests.ge... | true | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.