hexsha stringlengths 40 40 | size int64 7 1.04M | ext stringclasses 10
values | lang stringclasses 1
value | max_stars_repo_path stringlengths 4 247 | max_stars_repo_name stringlengths 4 125 | max_stars_repo_head_hexsha stringlengths 40 78 | max_stars_repo_licenses listlengths 1 10 | max_stars_count int64 1 368k ⌀ | 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 247 | max_issues_repo_name stringlengths 4 125 | max_issues_repo_head_hexsha stringlengths 40 78 | max_issues_repo_licenses listlengths 1 10 | max_issues_count int64 1 116k ⌀ | 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 247 | max_forks_repo_name stringlengths 4 125 | max_forks_repo_head_hexsha stringlengths 40 78 | 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 1 1.04M | avg_line_length float64 1.77 618k | max_line_length int64 1 1.02M | alphanum_fraction float64 0 1 | original_content stringlengths 7 1.04M | filtered:remove_function_no_docstring int64 -102 942k | filtered:remove_class_no_docstring int64 -354 977k | filtered:remove_delete_markers int64 0 60.1k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1c128ff78f15577fb04cfae6c313098089fc1267 | 1,803 | py | Python | tests/components/vaillant/test_init.py | dmaisonn/home-assistant | e40e5bf4ab5093dd30fc95ab7a68ce41d3742d9f | [
"Apache-2.0"
] | null | null | null | tests/components/vaillant/test_init.py | dmaisonn/home-assistant | e40e5bf4ab5093dd30fc95ab7a68ce41d3742d9f | [
"Apache-2.0"
] | null | null | null | tests/components/vaillant/test_init.py | dmaisonn/home-assistant | e40e5bf4ab5093dd30fc95ab7a68ce41d3742d9f | [
"Apache-2.0"
] | null | null | null | """Tests for the vaillant HUB."""
import mock
import pytest
from pymultimatic.api import ApiError
from homeassistant.components import vaillant
from homeassistant.components.vaillant import DOMAIN
from tests.components.vaillant import _setup, SystemManagerMock
@pytest.fixture(autouse=True)
def fixture_no_platform(m... | 30.559322 | 63 | 0.719911 | """Tests for the vaillant HUB."""
import mock
import pytest
from pymultimatic.api import ApiError
from homeassistant.components import vaillant
from homeassistant.components.vaillant import DOMAIN
from tests.components.vaillant import _setup, SystemManagerMock
@pytest.fixture(autouse=True)
def fixture_no_platform(m... | 515 | 0 | 54 |
a0130fe08c7f469c02240d34542a1eca14984049 | 4,614 | py | Python | src/website/apps/packages/views.py | rapidsms/rapidsms.org | db871949797150e654a42afe00fc9e8f9fc1559e | [
"Apache-2.0"
] | 2 | 2015-10-09T04:48:55.000Z | 2020-05-29T18:33:39.000Z | src/website/apps/packages/views.py | rapidsms/rapidsms.org | db871949797150e654a42afe00fc9e8f9fc1559e | [
"Apache-2.0"
] | 22 | 2015-09-20T14:00:16.000Z | 2021-06-10T20:08:25.000Z | src/website/apps/packages/views.py | rapidsms/rapidsms.org | db871949797150e654a42afe00fc9e8f9fc1559e | [
"Apache-2.0"
] | 6 | 2015-12-14T21:05:01.000Z | 2019-11-02T19:35:24.000Z | import datetime
from django.contrib import messages
from django.shortcuts import redirect
from django.utils import timezone
from django.views.generic import CreateView, DetailView, FormView, UpdateView, View
from django.views.generic.detail import SingleObjectMixin
from website.apps.core.mixins import IsActiveObjectM... | 36.330709 | 97 | 0.696792 | import datetime
from django.contrib import messages
from django.shortcuts import redirect
from django.utils import timezone
from django.views.generic import CreateView, DetailView, FormView, UpdateView, View
from django.views.generic.detail import SingleObjectMixin
from website.apps.core.mixins import IsActiveObjectM... | 2,494 | 345 | 253 |
071b0d8d4806b63e684f90c18734504cdce03709 | 11,297 | py | Python | server/src/server.py | ladyrassilon/brat | 69c287df5410221c49e0560d6cdea063aa4d4441 | [
"CC-BY-3.0"
] | null | null | null | server/src/server.py | ladyrassilon/brat | 69c287df5410221c49e0560d6cdea063aa4d4441 | [
"CC-BY-3.0"
] | null | null | null | server/src/server.py | ladyrassilon/brat | 69c287df5410221c49e0560d6cdea063aa4d4441 | [
"CC-BY-3.0"
] | null | null | null | #!/usr/bin/env python
# -*- Mode: Python; tab-width: 4; indent-tabs-mode: nil; -*-
# vim:set ft=python ts=4 sw=4 sts=4 autoindent:
"""Main entry for the brat server, ensures integrity, handles dispatch and
processes potential exceptions before returning them to be sent as responses.
NOTE(S):
* Defer imports until fa... | 33.032164 | 104 | 0.642471 | #!/usr/bin/env python
# -*- Mode: Python; tab-width: 4; indent-tabs-mode: nil; -*-
# vim:set ft=python ts=4 sw=4 sts=4 autoindent:
"""Main entry for the brat server, ensures integrity, handles dispatch and
processes potential exceptions before returning them to be sent as responses.
NOTE(S):
* Defer imports until fa... | 9,469 | 34 | 352 |
7d1c639d43321ee2fb5737f7743b1a5c0ac293a0 | 1,544 | py | Python | src/handlers/mail/handler.py | alienhard/notify | a288d7472d930aad693559ebd5dd88d0b8c9a087 | [
"Unlicense",
"MIT"
] | 1 | 2015-11-05T08:10:08.000Z | 2015-11-05T08:10:08.000Z | src/handlers/mail/handler.py | alienhard/notify | a288d7472d930aad693559ebd5dd88d0b8c9a087 | [
"Unlicense",
"MIT"
] | null | null | null | src/handlers/mail/handler.py | alienhard/notify | a288d7472d930aad693559ebd5dd88d0b8c9a087 | [
"Unlicense",
"MIT"
] | null | null | null | """A handler that sends mails."""
import smtplib
import os.path
from ConfigParser import RawConfigParser
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
# load config
CFG_PATH = os.path.join(
os.path.dirname(__file__), '..', '..', '..', 'notify.cfg')
CONFIG = RawConfigParser()... | 32.851064 | 68 | 0.649611 | """A handler that sends mails."""
import smtplib
import os.path
from ConfigParser import RawConfigParser
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
# load config
CFG_PATH = os.path.join(
os.path.dirname(__file__), '..', '..', '..', 'notify.cfg')
CONFIG = RawConfigParser()... | 114 | 0 | 31 |
dcb82a9a058d131986ce58d00060551a60dc1503 | 2,674 | py | Python | tests/test_estimate.py | rubensmau/splink | da4f5d5bc09753b6c6974af308dd1bad324d9b4b | [
"MIT"
] | 176 | 2020-03-16T15:19:39.000Z | 2022-03-30T06:38:29.000Z | tests/test_estimate.py | rubensmau/splink | da4f5d5bc09753b6c6974af308dd1bad324d9b4b | [
"MIT"
] | 194 | 2020-03-01T21:32:26.000Z | 2022-03-30T14:58:38.000Z | tests/test_estimate.py | rubensmau/splink | da4f5d5bc09753b6c6974af308dd1bad324d9b4b | [
"MIT"
] | 25 | 2020-03-07T00:09:22.000Z | 2022-03-11T16:28:06.000Z | from pyspark.sql import Row
from string import ascii_lowercase
from splink.estimate import estimate_u_values
from uuid import uuid4
from splink.case_statements import sql_gen_case_smnt_strict_equality_2
import pytest
| 27.285714 | 90 | 0.568437 | from pyspark.sql import Row
from string import ascii_lowercase
from splink.estimate import estimate_u_values
from uuid import uuid4
from splink.case_statements import sql_gen_case_smnt_strict_equality_2
import pytest
def test_u_estimate(spark):
# u is the probability of a 'collision' i.e. that amongst non-matc... | 2,431 | 0 | 23 |
dfcd6b81ed92cc249830db379d1f335194889506 | 1,127 | py | Python | jeffnet/objax/layers/drop_path.py | Forbu/efficientnet-jax | eb9ed23826a92761bd3c8d88df0243910c9c24bd | [
"Apache-2.0"
] | 95 | 2020-10-28T22:32:55.000Z | 2022-03-09T09:37:34.000Z | jeffnet/objax/layers/drop_path.py | Forbu/efficientnet-jax | eb9ed23826a92761bd3c8d88df0243910c9c24bd | [
"Apache-2.0"
] | 2 | 2021-03-19T17:03:06.000Z | 2022-02-02T17:48:10.000Z | jeffnet/objax/layers/drop_path.py | Forbu/efficientnet-jax | eb9ed23826a92761bd3c8d88df0243910c9c24bd | [
"Apache-2.0"
] | 8 | 2020-11-01T14:05:02.000Z | 2022-03-18T14:33:19.000Z | """ Drop Path
Hacked together by / Copyright 2020 Ross Wightman (https://github.com/rwightman)
"""
import jax.random as jr
from objax import random
from objax.typing import JaxArray
def drop_path(x: JaxArray, drop_prob: float = 0., generator=random.DEFAULT_GENERATOR) -> JaxArray:
"""Drop paths (Stochastic Depth) ... | 41.740741 | 108 | 0.71606 | """ Drop Path
Hacked together by / Copyright 2020 Ross Wightman (https://github.com/rwightman)
"""
import jax.random as jr
from objax import random
from objax.typing import JaxArray
def drop_path(x: JaxArray, drop_prob: float = 0., generator=random.DEFAULT_GENERATOR) -> JaxArray:
"""Drop paths (Stochastic Depth) ... | 0 | 0 | 0 |
8d2d318b18054d2bae8663b41f5c32f33d2b79a6 | 6,646 | py | Python | docs_src/nbval/cover.py | discdiver/fastai_docs | ab9fc7aa66441b0ae3ce4d2fe42c706989708f41 | [
"Apache-2.0"
] | 59 | 2020-08-18T03:41:35.000Z | 2022-03-23T03:51:55.000Z | docs_src/nbval/cover.py | discdiver/fastai_docs | ab9fc7aa66441b0ae3ce4d2fe42c706989708f41 | [
"Apache-2.0"
] | 17 | 2020-08-25T14:15:32.000Z | 2022-03-27T02:12:19.000Z | docs_src/nbval/cover.py | discdiver/fastai_docs | ab9fc7aa66441b0ae3ce4d2fe42c706989708f41 | [
"Apache-2.0"
] | 89 | 2020-08-17T23:45:42.000Z | 2022-03-27T20:53:43.000Z | """
Code to enable coverage of any external code called by the
notebook.
"""
import os
import coverage
# Coverage setup/teardown code to run in kernel
# Inspired by pytest-cov code.
_python_setup = """\
import coverage
__cov = coverage.Coverage(
data_file=%r,
source=%r,
config_file=%r,
auto_data=Tru... | 34.082051 | 93 | 0.684773 | """
Code to enable coverage of any external code called by the
notebook.
"""
import os
import coverage
# Coverage setup/teardown code to run in kernel
# Inspired by pytest-cov code.
_python_setup = """\
import coverage
__cov = coverage.Coverage(
data_file=%r,
source=%r,
config_file=%r,
auto_data=Tru... | 0 | 0 | 0 |
2b8602776854cc47421023ad8c0fb56222d69736 | 176 | py | Python | flask version/src/flaskapp/api/welcome.py | abhiWriteCode/TextSummarization | e2ed2dddc6afaa5a5106cfda19a3bd8d520f63a4 | [
"MIT"
] | null | null | null | flask version/src/flaskapp/api/welcome.py | abhiWriteCode/TextSummarization | e2ed2dddc6afaa5a5106cfda19a3bd8d520f63a4 | [
"MIT"
] | null | null | null | flask version/src/flaskapp/api/welcome.py | abhiWriteCode/TextSummarization | e2ed2dddc6afaa5a5106cfda19a3bd8d520f63a4 | [
"MIT"
] | null | null | null | from flask import request
from flask_restful import Resource
| 19.555556 | 67 | 0.727273 | from flask import request
from flask_restful import Resource
class Welcome(Resource):
def get(self):
return {'message': 'Welcome To TextSummarization.com'}, 200
| 61 | 3 | 50 |
357f9eae3ce13bf5f56bfda252ff78e9e74eab55 | 433 | py | Python | HSapi.py | starcreep48/HearthStoneBGLite | e6be99de8b1359ac3626cab95155805982c7301d | [
"MIT"
] | 2 | 2021-09-13T02:54:29.000Z | 2021-09-13T02:55:48.000Z | HSapi.py | starcreep48/HearthStoneBGLite | e6be99de8b1359ac3626cab95155805982c7301d | [
"MIT"
] | 1 | 2021-09-13T03:29:25.000Z | 2021-09-13T03:29:25.000Z | HSapi.py | starcreep48/HearthStoneBGLite | e6be99de8b1359ac3626cab95155805982c7301d | [
"MIT"
] | null | null | null | import requests
import json
from blizzardapi import BlizzardApi
f = open('utils/APIClient.json',)
data = json.load(f)
api_client = BlizzardApi(data['client_id'], data['client_secret'])
for i in range(0,6):
data = api_client.hearthstone.game_data.search_cards("eu","en_US", game_mode="battlegrounds", tier=i+1, p... | 24.055556 | 115 | 0.706697 | import requests
import json
from blizzardapi import BlizzardApi
f = open('utils/APIClient.json',)
data = json.load(f)
api_client = BlizzardApi(data['client_id'], data['client_secret'])
for i in range(0,6):
data = api_client.hearthstone.game_data.search_cards("eu","en_US", game_mode="battlegrounds", tier=i+1, p... | 0 | 0 | 0 |
7c6b4cf049dc0a46d272e08c2bb73161a1703890 | 439 | py | Python | FastSimulation/Configuration/python/Geometries_START_cff.py | ckamtsikis/cmssw | ea19fe642bb7537cbf58451dcf73aa5fd1b66250 | [
"Apache-2.0"
] | 852 | 2015-01-11T21:03:51.000Z | 2022-03-25T21:14:00.000Z | FastSimulation/Configuration/python/Geometries_START_cff.py | ckamtsikis/cmssw | ea19fe642bb7537cbf58451dcf73aa5fd1b66250 | [
"Apache-2.0"
] | 30,371 | 2015-01-02T00:14:40.000Z | 2022-03-31T23:26:05.000Z | FastSimulation/Configuration/python/Geometries_START_cff.py | ckamtsikis/cmssw | ea19fe642bb7537cbf58451dcf73aa5fd1b66250 | [
"Apache-2.0"
] | 3,240 | 2015-01-02T05:53:18.000Z | 2022-03-31T17:24:21.000Z | import FWCore.ParameterSet.Config as cms
from FastSimulation.Configuration.Geometries_cff import *
import FastSimulation.SimplifiedGeometryPropagator.fastSimProducer_cff
# Apply Tracker and Muon misalignment
process.fastSimProducer.detectorDefinition.trackerAlignmentLabel = cms.untracked.string("")
misalignedTracker... | 33.769231 | 91 | 0.872437 | import FWCore.ParameterSet.Config as cms
from FastSimulation.Configuration.Geometries_cff import *
import FastSimulation.SimplifiedGeometryPropagator.fastSimProducer_cff
# Apply Tracker and Muon misalignment
process.fastSimProducer.detectorDefinition.trackerAlignmentLabel = cms.untracked.string("")
misalignedTracker... | 0 | 0 | 0 |
f7abf593367dd391c38c66127ed9e95f4471d6c8 | 3,803 | py | Python | mezzanine_sync_pages/sync_pages.py | eht16/mezzanine-sync-pages | aedff9b841e59f1138fb609208149c34cebf3e32 | [
"MIT"
] | 1 | 2021-06-20T16:23:04.000Z | 2021-06-20T16:23:04.000Z | mezzanine_sync_pages/sync_pages.py | eht16/mezzanine-sync-pages | aedff9b841e59f1138fb609208149c34cebf3e32 | [
"MIT"
] | null | null | null | mezzanine_sync_pages/sync_pages.py | eht16/mezzanine-sync-pages | aedff9b841e59f1138fb609208149c34cebf3e32 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
#
# This software may be modified and distributed under the terms
# of the MIT license. See the LICENSE file for details.
from collections import OrderedDict
from difflib import unified_diff
from os.path import splitext
from pathlib import Path
from mezzanine.pages.models import Page
from me... | 40.457447 | 93 | 0.566658 | # -*- coding: utf-8 -*-
#
# This software may be modified and distributed under the terms
# of the MIT license. See the LICENSE file for details.
from collections import OrderedDict
from difflib import unified_diff
from os.path import splitext
from pathlib import Path
from mezzanine.pages.models import Page
from me... | 2,666 | 20 | 205 |
795ff5b3b99d58886be95db429158791cfb59c12 | 2,632 | py | Python | web_app/pages.py | joejcollins/WomertonFarm | 96167530d37f5aab6ae91cc8ff4583a86740e3f4 | [
"MIT"
] | null | null | null | web_app/pages.py | joejcollins/WomertonFarm | 96167530d37f5aab6ae91cc8ff4583a86740e3f4 | [
"MIT"
] | 1 | 2021-06-02T00:18:04.000Z | 2021-06-02T00:18:04.000Z | web_app/pages.py | joejcollins/WomertonFarm | 96167530d37f5aab6ae91cc8ff4583a86740e3f4 | [
"MIT"
] | null | null | null | import logging
import webapp2
import config
import re
import json
import models
from google.appengine.api import mail
'''
Base controller to deal with 500 errors
'''
class base_page_controller(webapp2.RequestHandler):
""" Base pag controller """
'''
Show the home page.
'''
'''
Send the email
'''
'''
Show the t... | 34.181818 | 111 | 0.615881 | import logging
import webapp2
import config
import re
import json
import models
from google.appengine.api import mail
'''
Base controller to deal with 500 errors
'''
class base_page_controller(webapp2.RequestHandler):
""" Base pag controller """
def handle_exception(self, exception, debug):
# Log the e... | 2,019 | 46 | 216 |
3b440d2e97a08b86babab12ddba45cf63bad0fa1 | 2,336 | py | Python | scripts/ScottieHDI.py | iancze/ScottiePippen | 500979fce8f7990f07bfcf1892608e93f0868711 | [
"MIT"
] | 1 | 2021-07-05T16:57:37.000Z | 2021-07-05T16:57:37.000Z | scripts/ScottieHDI.py | iancze/ScottiePippen | 500979fce8f7990f07bfcf1892608e93f0868711 | [
"MIT"
] | null | null | null | scripts/ScottieHDI.py | iancze/ScottiePippen | 500979fce8f7990f07bfcf1892608e93f0868711 | [
"MIT"
] | 1 | 2021-02-19T23:53:48.000Z | 2021-02-19T23:53:48.000Z | #!/usr/bin/env python
import argparse
parser = argparse.ArgumentParser(description="Measure statistics across multiple chains.")
parser.add_argument("--burn", type=int, default=0, help="How many samples to discard from the beginning of the chain for burn in.")
parser.add_argument("--config", default="config.yaml", he... | 27.482353 | 207 | 0.668236 | #!/usr/bin/env python
import argparse
parser = argparse.ArgumentParser(description="Measure statistics across multiple chains.")
parser.add_argument("--burn", type=int, default=0, help="How many samples to discard from the beginning of the chain for burn in.")
parser.add_argument("--config", default="config.yaml", he... | 931 | 0 | 22 |
782c34df562523395cc6b6e3d5a3fc26d56c139f | 468 | py | Python | archive/pygame-cardgame-old-0-1/main.py | KingJellycycle/pygame-hexwar | db56d0bba0cc7430081bc6481402c8e998dcea6a | [
"MIT"
] | null | null | null | archive/pygame-cardgame-old-0-1/main.py | KingJellycycle/pygame-hexwar | db56d0bba0cc7430081bc6481402c8e998dcea6a | [
"MIT"
] | null | null | null | archive/pygame-cardgame-old-0-1/main.py | KingJellycycle/pygame-hexwar | db56d0bba0cc7430081bc6481402c8e998dcea6a | [
"MIT"
] | null | null | null | import pygame
import game
pygame.init()
pygame.display.set_caption('R')
clock = pygame.time.Clock()
fps = 60
gameDisp = pygame.display.set_mode((800, 600), pygame.HWSURFACE|pygame.DOUBLEBUF|pygame.RESIZABLE)
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
quitfun... | 16.714286 | 98 | 0.65812 | import pygame
import game
pygame.init()
pygame.display.set_caption('R')
clock = pygame.time.Clock()
fps = 60
gameDisp = pygame.display.set_mode((800, 600), pygame.HWSURFACE|pygame.DOUBLEBUF|pygame.RESIZABLE)
def quitfunc():
pygame.quit()
quit()
while True:
for event in pygame.event.get():
if ... | 23 | 0 | 23 |
67c08c3ead1d145e220d4c387aa1e388e43e0459 | 143 | py | Python | backend/src/app/db.py | wooshifu/Blog | a8ad6a7e1e1bb312b64f54414e5d945b73df5e1d | [
"MIT"
] | null | null | null | backend/src/app/db.py | wooshifu/Blog | a8ad6a7e1e1bb312b64f54414e5d945b73df5e1d | [
"MIT"
] | 3 | 2021-05-07T11:38:25.000Z | 2022-02-26T10:26:47.000Z | backend/src/app/db.py | wooshifu/Blog | a8ad6a7e1e1bb312b64f54414e5d945b73df5e1d | [
"MIT"
] | null | null | null | from flask_sqlalchemy import SQLAlchemy
from .app import app
db = SQLAlchemy(app)
db_engine = db.engine
db_connection = db_engine.connect()
| 15.888889 | 39 | 0.79021 | from flask_sqlalchemy import SQLAlchemy
from .app import app
db = SQLAlchemy(app)
db_engine = db.engine
db_connection = db_engine.connect()
| 0 | 0 | 0 |
2a942401302f4a6f04e567df730fec2109c6ddf7 | 540 | py | Python | django_experiment/accounts/migrations/0009_auto_20180608_0457.py | prakashgowinji/Django_experiment | e8c9007b7b9ed3e766e800acb9f64963b2f2633b | [
"Apache-2.0"
] | null | null | null | django_experiment/accounts/migrations/0009_auto_20180608_0457.py | prakashgowinji/Django_experiment | e8c9007b7b9ed3e766e800acb9f64963b2f2633b | [
"Apache-2.0"
] | null | null | null | django_experiment/accounts/migrations/0009_auto_20180608_0457.py | prakashgowinji/Django_experiment | e8c9007b7b9ed3e766e800acb9f64963b2f2633b | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
# Generated by Django 1.11.13 on 2018-06-08 04:57
from __future__ import unicode_literals
import django.core.validators
from django.db import migrations, models
| 24.545455 | 105 | 0.659259 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.13 on 2018-06-08 04:57
from __future__ import unicode_literals
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('accounts', '0008_auto_20180608_0454'),
]
operations ... | 0 | 330 | 23 |
116119aaea8a52ec7dbfdd93a0e0acd55babcd77 | 2,641 | py | Python | util/data.py | coleblackman/AccDNN | 932579548283a9f2da3f366e131e37c48ac58eaf | [
"Apache-2.0"
] | 231 | 2019-08-28T16:42:55.000Z | 2022-03-30T09:40:19.000Z | util/data.py | coleblackman/AccDNN | 932579548283a9f2da3f366e131e37c48ac58eaf | [
"Apache-2.0"
] | 13 | 2019-10-08T07:08:15.000Z | 2021-06-23T05:58:10.000Z | util/data.py | coleblackman/AccDNN | 932579548283a9f2da3f366e131e37c48ac58eaf | [
"Apache-2.0"
] | 81 | 2019-09-24T07:11:11.000Z | 2022-03-23T00:15:03.000Z | #!/usr/bin/env python
from settings import *
import numpy as np
import struct
| 26.676768 | 84 | 0.581219 | #!/usr/bin/env python
from settings import *
import numpy as np
import struct
def _bool2int(x, dw):
y = 0
for i,j in enumerate(x):
y += j<<(i * dw)
return y
def _quantize(mat, dw, dq, is_complement=True):
FIX_POINT_MAX = 2 ** (dw - 1) - 1
FIX_POINT_MIN = - 2 ** (dw - 1)
FIX_POINT_SCAL... | 2,401 | 0 | 161 |
0856d48337c436c20d03311161727a4a552f16cc | 1,067 | py | Python | qa/tasks/mds_pre_upgrade.py | rpratap-bot/ceph | 9834961a66927ae856935591f2fd51082e2ee484 | [
"MIT"
] | 4 | 2020-04-08T03:42:02.000Z | 2020-10-01T20:34:48.000Z | qa/tasks/mds_pre_upgrade.py | rpratap-bot/ceph | 9834961a66927ae856935591f2fd51082e2ee484 | [
"MIT"
] | 93 | 2020-03-26T14:29:14.000Z | 2020-11-12T05:54:55.000Z | qa/tasks/mds_pre_upgrade.py | rpratap-bot/ceph | 9834961a66927ae856935591f2fd51082e2ee484 | [
"MIT"
] | 23 | 2020-03-24T10:28:44.000Z | 2020-09-24T09:42:19.000Z | """
Prepare MDS cluster for upgrade.
"""
import logging
import time
from tasks.cephfs.filesystem import Filesystem
log = logging.getLogger(__name__)
def task(ctx, config):
"""
Prepare MDS cluster for upgrade.
This task reduces ranks to 1 and stops all standbys.
"""
if config is None:
c... | 24.25 | 82 | 0.63074 | """
Prepare MDS cluster for upgrade.
"""
import logging
import time
from tasks.cephfs.filesystem import Filesystem
log = logging.getLogger(__name__)
def task(ctx, config):
"""
Prepare MDS cluster for upgrade.
This task reduces ranks to 1 and stops all standbys.
"""
if config is None:
c... | 0 | 0 | 0 |
118eede795109ec14575911abf2dab8cf71f18f0 | 12,991 | py | Python | test/test_soft_functions.py | pythoro/npsolve | c6993dd7a10a60a09655f0252c3ad36fe7dc3af1 | [
"MIT"
] | null | null | null | test/test_soft_functions.py | pythoro/npsolve | c6993dd7a10a60a09655f0252c3ad36fe7dc3af1 | [
"MIT"
] | null | null | null | test/test_soft_functions.py | pythoro/npsolve | c6993dd7a10a60a09655f0252c3ad36fe7dc3af1 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""
Created on Thu May 21 15:21:59 2020
@author: Reuben
"""
import unittest
import numpy as np
import npsolve.soft_functions as soft
| 29.93318 | 77 | 0.600955 | # -*- coding: utf-8 -*-
"""
Created on Thu May 21 15:21:59 2020
@author: Reuben
"""
import unittest
import numpy as np
import npsolve.soft_functions as soft
class Test_lim_scalar(unittest.TestCase):
def setUp(self):
self.vals = [-1000, 2.5, 3.5, 1000]
self.limit = 3.0
def test_m100... | 8,894 | 571 | 3,237 |
e6909a63b858aaab236c2ea1f74b30cc95f975a1 | 6,064 | py | Python | chinilla/wallet/puzzles/p2_delegated_puzzle_or_hidden_puzzle.py | Chinilla/chinilla-blockchain | 59bebcf94e65b74fbb53ad4929bbd79cb28be619 | [
"Apache-2.0"
] | null | null | null | chinilla/wallet/puzzles/p2_delegated_puzzle_or_hidden_puzzle.py | Chinilla/chinilla-blockchain | 59bebcf94e65b74fbb53ad4929bbd79cb28be619 | [
"Apache-2.0"
] | null | null | null | chinilla/wallet/puzzles/p2_delegated_puzzle_or_hidden_puzzle.py | Chinilla/chinilla-blockchain | 59bebcf94e65b74fbb53ad4929bbd79cb28be619 | [
"Apache-2.0"
] | null | null | null | """
Pay to delegated puzzle or hidden puzzle
In this puzzle program, the solution must choose either a hidden puzzle or a
delegated puzzle on a given public key.
The given public key is morphed by adding an offset from the hash of the hidden puzzle
and itself, giving a new so-called "synthetic" public key which has t... | 43.942029 | 112 | 0.805904 | """
Pay to delegated puzzle or hidden puzzle
In this puzzle program, the solution must choose either a hidden puzzle or a
delegated puzzle on a given public key.
The given public key is morphed by adding an offset from the hash of the hidden puzzle
and itself, giving a new so-called "synthetic" public key which has t... | 2,064 | 0 | 230 |
72019bd8e5e41358e23b334d8ffd731d98b0e8e6 | 319 | py | Python | instagram_api/response/model/surface.py | Yuego/instagram_api | b53f72db36c505a2eb24ebac1ba8267a0cc295bb | [
"MIT"
] | 13 | 2019-08-07T21:24:34.000Z | 2020-12-12T12:23:50.000Z | instagram_api/response/model/surface.py | Yuego/instagram_api | b53f72db36c505a2eb24ebac1ba8267a0cc295bb | [
"MIT"
] | null | null | null | instagram_api/response/model/surface.py | Yuego/instagram_api | b53f72db36c505a2eb24ebac1ba8267a0cc295bb | [
"MIT"
] | null | null | null | from ..mapper import PropertyMapper, ApiInterfaceBase
from ..mapper.types import Timestamp, AnyType
__all__ = ['Surface', 'SurfaceInterface']
| 19.9375 | 53 | 0.752351 | from ..mapper import PropertyMapper, ApiInterfaceBase
from ..mapper.types import Timestamp, AnyType
__all__ = ['Surface', 'SurfaceInterface']
class SurfaceInterface(ApiInterfaceBase):
scores: AnyType
rank_token: str
ttl_secs: int
name: str
class Surface(PropertyMapper, SurfaceInterface):
pass
| 0 | 128 | 46 |
e180cbbf5ea7cf4b75b1d96f732e78aea9dce5fb | 1,029 | py | Python | bobail/game.py | jasondaming/bobail | cbc3796c5da9ff1daae0ed6729e1c336c79322b2 | [
"MIT"
] | null | null | null | bobail/game.py | jasondaming/bobail | cbc3796c5da9ff1daae0ed6729e1c336c79322b2 | [
"MIT"
] | null | null | null | bobail/game.py | jasondaming/bobail | cbc3796c5da9ff1daae0ed6729e1c336c79322b2 | [
"MIT"
] | null | null | null | from .board import Board
| 22.866667 | 69 | 0.684159 | from .board import Board
class Game:
def __init__(self):
self.board = Board()
self.moves = []
def move(self, move):
if move not in self.get_possible_moves():
raise ValueError('The provided move is not possible')
self.board = self.board.create_new_board_from_move(move)
self.moves.append(m... | 805 | -10 | 208 |
1a6215d3350ac4e3303621c3a83321c45c23ef4f | 6,085 | py | Python | src/quality_check.py | Jasplet/SKS_Splitting | d5c3ea442e75fd9643c31575158cf350aa41a5e2 | [
"MIT"
] | null | null | null | src/quality_check.py | Jasplet/SKS_Splitting | d5c3ea442e75fd9643c31575158cf350aa41a5e2 | [
"MIT"
] | null | null | null | src/quality_check.py | Jasplet/SKS_Splitting | d5c3ea442e75fd9643c31575158cf350aa41a5e2 | [
"MIT"
] | null | null | null | #! /usr/bin/env python
######################
# quality_check.py
######################
# A program to loop through and inspect SWS results, plot the QA result from
# Splitwavepy and print the measured SKS and SKKS splitting from Sheba
# A measure of measure of data quality and discernable discrepancy between results i... | 47.913386 | 178 | 0.560394 | #! /usr/bin/env python
######################
# quality_check.py
######################
# A program to loop through and inspect SWS results, plot the QA result from
# Splitwavepy and print the measured SKS and SKKS splitting from Sheba
# A measure of measure of data quality and discernable discrepancy between results i... | 1,333 | 3,436 | 23 |
c5e2383a33736e97cabae7f5d8ed6150518462ce | 506 | py | Python | source/pkgsrc/devel/gyp/patches/patch-gyptest.py | Scottx86-64/dotfiles-1 | 51004b1e2b032664cce6b553d2052757c286087d | [
"Unlicense"
] | 1 | 2021-11-20T22:46:39.000Z | 2021-11-20T22:46:39.000Z | source/pkgsrc/devel/gyp/patches/patch-gyptest.py | Scottx86-64/dotfiles-1 | 51004b1e2b032664cce6b553d2052757c286087d | [
"Unlicense"
] | null | null | null | source/pkgsrc/devel/gyp/patches/patch-gyptest.py | Scottx86-64/dotfiles-1 | 51004b1e2b032664cce6b553d2052757c286087d | [
"Unlicense"
] | null | null | null | $NetBSD: patch-gyptest.py,v 1.4 2014/08/21 14:49:43 he Exp $
* Add NetBSD 5, 6 and 7 target
--- gyptest.py.orig 2014-07-14 14:19:50.000000000 +0000
+++ gyptest.py
+ 'freebsd9': ['make'],
+ 'netbsd5': ['make'],
+ 'netbsd6': ['make'],
+ 'netbsd7': ['make'],
'openbsd5': ['make'],
'cy... | 28.111111 | 60 | 0.492095 | $NetBSD: patch-gyptest.py,v 1.4 2014/08/21 14:49:43 he Exp $
* Add NetBSD 5, 6 and 7 target
--- gyptest.py.orig 2014-07-14 14:19:50.000000000 +0000
+++ gyptest.py
@@ -219,6 +219,10 @@ def main(argv=None):
'aix5': ['make'],
'freebsd7': ['make'],
'freebsd8': ['make'],
+ 'freebsd9': ['make'... | 86 | 0 | 43 |
f23057a09466d349b3a7d0a7a4009277442d1ab7 | 363 | py | Python | GradeFromJOJ/utils.py | makersmelx/giteaAdmin | 78f9f16193ddd9387643a97bd19b098c7515c5c9 | [
"MIT"
] | 2 | 2021-06-22T09:45:13.000Z | 2021-07-01T11:33:49.000Z | GradeFromJOJ/utils.py | makersmelx/GiteaCanvasHelper | 78f9f16193ddd9387643a97bd19b098c7515c5c9 | [
"MIT"
] | null | null | null | GradeFromJOJ/utils.py | makersmelx/GiteaCanvasHelper | 78f9f16193ddd9387643a97bd19b098c7515c5c9 | [
"MIT"
] | null | null | null | """
Canvas fast grading script
by makersmelx <makersmelx@gmail.com>
"""
import os
dotenv_path = '.env'
| 20.166667 | 59 | 0.548209 | """
Canvas fast grading script
by makersmelx <makersmelx@gmail.com>
"""
import os
dotenv_path = '.env'
def import_env():
with open(dotenv_path) as dotenv:
for line in dotenv:
var = line.strip().split('=')
if len(var) == 2:
key, value = var[0].strip(), var[1].strip... | 234 | 0 | 23 |
df39496dc3f788369aa2880d44850388523444c8 | 3,656 | py | Python | pythonProject1/venv/Lib/site-packages/xdis/wordcode.py | mjtomlinson/CNE330_Python_1_Final_Project | 05020806860937ef37b9a0ad2e27de4897a606de | [
"CC0-1.0"
] | 1 | 2021-05-20T19:33:37.000Z | 2021-05-20T19:33:37.000Z | pythonProject1/venv/Lib/site-packages/xdis/wordcode.py | mjtomlinson/CNE330_Python_1_Final_Project | 05020806860937ef37b9a0ad2e27de4897a606de | [
"CC0-1.0"
] | 4 | 2020-10-03T20:37:55.000Z | 2020-10-04T23:11:38.000Z | pythonProject1/venv/Lib/site-packages/xdis/wordcode.py | mjtomlinson/CNE330_Python_1_Final_Project | 05020806860937ef37b9a0ad2e27de4897a606de | [
"CC0-1.0"
] | null | null | null | # (C) Copyright 2018, 2020 by Rocky Bernstein
#
# 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 2
# of the License, or (at your option) any later version.
#
# This program is... | 35.495146 | 82 | 0.616794 | # (C) Copyright 2018, 2020 by Rocky Bernstein
#
# 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 2
# of the License, or (at your option) any later version.
#
# This program is... | 857 | 0 | 23 |
911e87840601ad9e07bc653246a69b865510a4f0 | 1,735 | py | Python | py/rotseutil/coords_operations.py | danielsela42/rotseutil | dedbe1b69ca3a12b6fad8ca9f187d274bcbd175a | [
"BSD-3-Clause"
] | 2 | 2019-11-03T02:02:08.000Z | 2022-01-19T23:05:14.000Z | py/rotseutil/coords_operations.py | danielsela42/rotseutil | dedbe1b69ca3a12b6fad8ca9f187d274bcbd175a | [
"BSD-3-Clause"
] | 5 | 2019-04-05T04:19:18.000Z | 2021-07-12T19:49:50.000Z | py/rotseutil/coords_operations.py | danielsela42/rotseutil | dedbe1b69ca3a12b6fad8ca9f187d274bcbd175a | [
"BSD-3-Clause"
] | 4 | 2019-06-16T01:55:53.000Z | 2021-01-25T21:23:31.000Z | '''
Created on Jul 30, 2017
@author: Daniel Sela, Arnon Sela
'''
def add_coords(coords, delta):
''' Adds (or substructs) number to (from) coords
Args:
coords: 235959.456 style coords
delta: ss number to add (negative to sub)
'''
temp = decim_2_sec(coords)
temp += delta
ret... | 23.133333 | 65 | 0.564265 | '''
Created on Jul 30, 2017
@author: Daniel Sela, Arnon Sela
'''
def decim_2_vec(decim):
if isinstance(decim, str):
decim = float(decim)
neg = decim < 0
temp = abs(decim)
dd = int(temp/10000.0)
temp -= dd*10000.0
mm = int(temp/100.0)
ss = temp-mm*100.0
if neg:
if dd !... | 662 | 0 | 69 |
c5f8e1ccf66b47e17b69d093de68e6cf6a78b345 | 1,028 | py | Python | src/djrtime/djrtime/ping.py | amitu/rtime | 6e23a2f86a2cae4399932879f0d157f8e63a8358 | [
"BSD-3-Clause"
] | 2 | 2017-04-01T14:05:58.000Z | 2017-04-02T07:57:56.000Z | src/djrtime/djrtime/ping.py | amitu/rtime | 6e23a2f86a2cae4399932879f0d157f8e63a8358 | [
"BSD-3-Clause"
] | 3 | 2016-11-08T08:00:08.000Z | 2016-11-08T08:15:20.000Z | src/djrtime/djrtime/ping.py | amitu/rtime | 6e23a2f86a2cae4399932879f0d157f8e63a8358 | [
"BSD-3-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import json
import os
import socket
import sys
import snappy
SERVER = "127.0.0.1"
PORT = 6543
if __name__ == "__main__":
ping()
| 22.347826 | 78 | 0.581712 | # -*- coding: utf-8 -*-
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import json
import os
import socket
import sys
import snappy
SERVER = "127.0.0.1"
PORT = 6543
class Message(object):
def __init__(self, host, app, name, otime, qtime=-1, rtime=-1,... | 657 | 1 | 99 |
7c266d199d62b0a295df3fa38288513a348bba04 | 4,656 | py | Python | alexia/api/v1/test/test_common.py | LaudateCorpus1/alexia-1 | 9c0d3c90c0ffe2237299a561b755b9c17905e354 | [
"BSD-3-Clause"
] | 8 | 2015-06-29T20:01:22.000Z | 2020-10-19T13:49:38.000Z | alexia/api/v1/test/test_common.py | LaudateCorpus1/alexia-1 | 9c0d3c90c0ffe2237299a561b755b9c17905e354 | [
"BSD-3-Clause"
] | 67 | 2015-10-05T16:57:14.000Z | 2022-03-28T19:57:36.000Z | alexia/api/v1/test/test_common.py | LaudateCorpus1/alexia-1 | 9c0d3c90c0ffe2237299a561b755b9c17905e354 | [
"BSD-3-Clause"
] | 6 | 2015-10-05T13:54:34.000Z | 2021-11-30T05:11:58.000Z | from __future__ import unicode_literals
import datetime
from django.utils import timezone
from alexia.apps.billing.models import (
Authorization, Order, PermanentProduct, PriceGroup, ProductGroup, Purchase,
TemporaryProduct,
)
from alexia.apps.scheduling.models import Event
from alexia.test import TestCase
... | 35.272727 | 117 | 0.570447 | from __future__ import unicode_literals
import datetime
from django.utils import timezone
from alexia.apps.billing.models import (
Authorization, Order, PermanentProduct, PriceGroup, ProductGroup, Purchase,
TemporaryProduct,
)
from alexia.apps.scheduling.models import Event
from alexia.test import TestCase
... | 2,572 | 1,684 | 23 |
4e3c72c968ae87c833f9164fa2b018d79930fd4d | 150,537 | py | Python | clustering_ICGS.py | kpeaton/altanalyze_wikitest | 93c38590d624fe75da51fbb7cffa55d8bd004a44 | [
"Apache-2.0"
] | 1 | 2018-09-01T03:00:38.000Z | 2018-09-01T03:00:38.000Z | clustering_ICGS.py | kpeaton/altanalyze_wikitest | 93c38590d624fe75da51fbb7cffa55d8bd004a44 | [
"Apache-2.0"
] | null | null | null | clustering_ICGS.py | kpeaton/altanalyze_wikitest | 93c38590d624fe75da51fbb7cffa55d8bd004a44 | [
"Apache-2.0"
] | null | null | null | ### clustering.py
#Copyright 2005-2008 J. David Gladstone Institutes, San Francisco California
#Author Nathan Salomonis - nsalomonis@gmail.com
#Permission is hereby granted, free of charge, to any person obtaining a copy
#of this software and associated documentation files (the "Software"), to deal
#in the Software ... | 45.192735 | 289 | 0.609691 | ### clustering.py
#Copyright 2005-2008 J. David Gladstone Institutes, San Francisco California
#Author Nathan Salomonis - nsalomonis@gmail.com
#Permission is hereby granted, free of charge, to any person obtaining a copy
#of this software and associated documentation files (the "Software"), to deal
#in the Software ... | 107,103 | 0 | 1,191 |
ce0314a695ab882fb5bd45d926498b8fe4832c5c | 12,822 | py | Python | twunnel/remote_proxy_server__ssh.py | jvansteirteghem/twunnel | 6de57636c7a9df03fe8452c5bc57071aad3719a7 | [
"MIT"
] | 16 | 2015-02-09T11:45:05.000Z | 2021-07-22T12:21:25.000Z | twunnel/remote_proxy_server__ssh.py | jvansteirteghem/twunnel | 6de57636c7a9df03fe8452c5bc57071aad3719a7 | [
"MIT"
] | null | null | null | twunnel/remote_proxy_server__ssh.py | jvansteirteghem/twunnel | 6de57636c7a9df03fe8452c5bc57071aad3719a7 | [
"MIT"
] | 7 | 2015-02-23T18:38:17.000Z | 2021-04-15T11:10:19.000Z | # Copyright (c) Jeroen Van Steirteghem
# See LICENSE
from twisted.conch import avatar
from twisted.conch.error import ValidPublicKey
from twisted.conch.ssh import channel, factory, forwarding, keys
from twisted.cred import checkers, credentials, portal
from twisted.cred.error import UnauthorizedLogin
from twisted.inte... | 37.165217 | 243 | 0.62463 | # Copyright (c) Jeroen Van Steirteghem
# See LICENSE
from twisted.conch import avatar
from twisted.conch.error import ValidPublicKey
from twisted.conch.ssh import channel, factory, forwarding, keys
from twisted.cred import checkers, credentials, portal
from twisted.cred.error import UnauthorizedLogin
from twisted.inte... | 10,581 | 1,408 | 348 |
6952c55eab27a48ef653c4e5bb2c9d93f71e8451 | 1,020 | py | Python | tests/http/test_todo.py | fumiya-kubota/sanic-gino-boilerplate | a2c17bdf6f733b0241f8de79c89aaf676e22e831 | [
"Apache-2.0"
] | 2 | 2020-04-01T16:13:58.000Z | 2020-06-05T01:41:08.000Z | tests/http/test_todo.py | fumiya-kubota/sanic-gino-boilerplate | a2c17bdf6f733b0241f8de79c89aaf676e22e831 | [
"Apache-2.0"
] | null | null | null | tests/http/test_todo.py | fumiya-kubota/sanic-gino-boilerplate | a2c17bdf6f733b0241f8de79c89aaf676e22e831 | [
"Apache-2.0"
] | null | null | null | import pytest
import json
@pytest.mark.usefixtures('cleanup_db')
async def test_todo_api(app, test_cli):
"""
testing todo api
"""
# GET
resp = await test_cli.get('/api/todo')
assert resp.status == 200
resp_json = await resp.json()
assert len(resp_json['todo_list']) == 0
# POST
... | 22.666667 | 58 | 0.586275 | import pytest
import json
@pytest.mark.usefixtures('cleanup_db')
async def test_todo_api(app, test_cli):
"""
testing todo api
"""
# GET
resp = await test_cli.get('/api/todo')
assert resp.status == 200
resp_json = await resp.json()
assert len(resp_json['todo_list']) == 0
# POST
... | 0 | 0 | 0 |
a1451a80dc933dfb9eabfc6cc4e08b7ca3d2d9c2 | 462 | py | Python | ros/src/tl_detector/light_classification/helper.py | Horki/CarND-Capstone | 08eccec79894afd7a8f23344883407cec493ff6f | [
"MIT"
] | 1 | 2019-12-30T17:26:53.000Z | 2019-12-30T17:26:53.000Z | ros/src/tl_detector/light_classification/helper.py | Horki/CarND-Capstone | 08eccec79894afd7a8f23344883407cec493ff6f | [
"MIT"
] | null | null | null | ros/src/tl_detector/light_classification/helper.py | Horki/CarND-Capstone | 08eccec79894afd7a8f23344883407cec493ff6f | [
"MIT"
] | null | null | null | import cv2
import tensorflow as tf
| 27.176471 | 54 | 0.645022 | import cv2
import tensorflow as tf
def load_model(model_path, graph):
with graph.as_default():
graph_def = tf.GraphDef()
with tf.gfile.GFile(model_path, 'rb') as gf:
serial_g = gf.read()
graph_def.ParseFromString(serial_g)
tf.import_graph_def(graph_def, name='')
... | 380 | 0 | 46 |
ebc8743bbdd50a952b777d07ace908c04f874bec | 1,384 | py | Python | tests/unit/returners/test_cassandra_cql_return.py | byteskeptical/salt | 637fe0b04f38b2274191b005d73b3c6707d7f400 | [
"Apache-2.0"
] | 5 | 2018-05-01T20:51:14.000Z | 2021-11-09T05:43:00.000Z | tests/unit/returners/test_cassandra_cql_return.py | byteskeptical/salt | 637fe0b04f38b2274191b005d73b3c6707d7f400 | [
"Apache-2.0"
] | 12 | 2015-04-15T22:17:42.000Z | 2016-03-22T08:46:27.000Z | tests/unit/returners/test_cassandra_cql_return.py | byteskeptical/salt | 637fe0b04f38b2274191b005d73b3c6707d7f400 | [
"Apache-2.0"
] | 7 | 2017-09-29T18:49:53.000Z | 2021-11-09T05:42:49.000Z | # -*- coding: utf-8 -*-
'''
Cassandra cql returner test cases
'''
# Import Python libs
from __future__ import absolute_import
# Import Salt Testing libs
from tests.support.unit import TestCase, skipIf
from tests.support.mock import patch, NO_MOCK, NO_MOCK_REASON
from tests.support.mixins import LoaderModuleMockMixin
... | 31.454545 | 85 | 0.693642 | # -*- coding: utf-8 -*-
'''
Cassandra cql returner test cases
'''
# Import Python libs
from __future__ import absolute_import
# Import Salt Testing libs
from tests.support.unit import TestCase, skipIf
from tests.support.mock import patch, NO_MOCK, NO_MOCK_REASON
from tests.support.mixins import LoaderModuleMockMixin
... | 45 | 0 | 26 |
1318456228d1e00ae213b51c7741c408a56491fa | 438 | py | Python | app/models/parameters/sms_params.py | twizoapi/lib-api-python | 115d0f574518fbe03f74801d743972c7593bf30e | [
"MIT"
] | null | null | null | app/models/parameters/sms_params.py | twizoapi/lib-api-python | 115d0f574518fbe03f74801d743972c7593bf30e | [
"MIT"
] | null | null | null | app/models/parameters/sms_params.py | twizoapi/lib-api-python | 115d0f574518fbe03f74801d743972c7593bf30e | [
"MIT"
] | null | null | null | from typing import List
| 25.764706 | 65 | 0.605023 | from typing import List
class SmsParams:
def __init__(self, recipients: List, body: str, sender: str):
self.recipients = recipients
self.body = body
self.sender = sender
self.senderNpi = None
self.senderTon = None
self.pid = None
self.scheduledDelivery = Non... | 369 | -5 | 49 |
f94c1eaf36512d0a8dbc9fd8550dda16f412aa27 | 2,031 | py | Python | entrec/read_json_file.py | raviqqe/simple-entity-recognition | 2649a62e2dd0a8886077b14830a3f4c095f87e2c | [
"Unlicense"
] | 1 | 2017-11-17T13:31:50.000Z | 2017-11-17T13:31:50.000Z | entrec/read_json_file.py | raviqqe/tensorflow-entrec | 2649a62e2dd0a8886077b14830a3f4c095f87e2c | [
"Unlicense"
] | null | null | null | entrec/read_json_file.py | raviqqe/tensorflow-entrec | 2649a62e2dd0a8886077b14830a3f4c095f87e2c | [
"Unlicense"
] | null | null | null | import json
import listpad
import numpy as np
import qnd
import qndex
import tensorflow as tf
def def_convert_json_example():
"""Define json example converter.
An example is the following.
```json
[
{ "word": "I", "label": 0 },
{ "word": "am", "label": 0 },
{ "word": "Bob... | 29.014286 | 78 | 0.55096 | import json
import listpad
import numpy as np
import qnd
import qndex
import tensorflow as tf
def def_convert_json_example():
"""Define json example converter.
An example is the following.
```json
[
{ "word": "I", "label": 0 },
{ "word": "am", "label": 0 },
{ "word": "Bob... | 1,516 | 0 | 50 |
bdec5f51827bd17e87bc0ccc6d0e20ffa5052433 | 35 | py | Python | swarm_controller/__init__.py | jaredvacanti/swarm-controller | f773ae5d80f5299b6b6df70ef228dfd22de7e3c3 | [
"MIT"
] | null | null | null | swarm_controller/__init__.py | jaredvacanti/swarm-controller | f773ae5d80f5299b6b6df70ef228dfd22de7e3c3 | [
"MIT"
] | 1 | 2019-11-18T02:35:46.000Z | 2019-11-18T02:35:46.000Z | swarm_controller/__init__.py | jaredvacanti/swarm-controller | f773ae5d80f5299b6b6df70ef228dfd22de7e3c3 | [
"MIT"
] | null | null | null | from swarm_controller.core import * | 35 | 35 | 0.857143 | from swarm_controller.core import * | 0 | 0 | 0 |
8ce40496b37bb33c1b031681daeb80c47d917265 | 1,701 | py | Python | common/RolloutStorage.py | yangzhao-666/Transfer-Learning-and-Curriculum-Learning-in-Sokoban | 6e50eec7603d05781fd1653589e606085920f99c | [
"MIT"
] | 5 | 2021-10-30T17:59:17.000Z | 2022-02-03T17:31:51.000Z | common/RolloutStorage.py | yangzhao-666/PbRSS | f7bd090e75cf394033fe95e7b15ce83e331c5ad9 | [
"MIT"
] | null | null | null | common/RolloutStorage.py | yangzhao-666/PbRSS | f7bd090e75cf394033fe95e7b15ce83e331c5ad9 | [
"MIT"
] | null | null | null | import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
import torch.autograd as autograd
class RolloutStorage():
"""
states: s s s s s s
rewards: r r r r r
actions: a a a a a
masks: 1 1 1 1 1 0
returns: t ... | 33.352941 | 97 | 0.611993 | import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
import torch.autograd as autograd
class RolloutStorage():
"""
states: s s s s s s
rewards: r r r r r
actions: a a a a a
masks: 1 1 1 1 1 0
returns: t ... | 1,229 | 0 | 134 |
5d127a5ec59076a35c86e212cd405528c52c80c9 | 5,726 | py | Python | ni_python_styleguide/_cli.py | Adithyak1998/python-styleguide | 86f162304607bbc583bec35e3e8b706b4cfa16f8 | [
"MIT"
] | 5 | 2020-08-19T15:33:12.000Z | 2021-12-15T02:16:56.000Z | ni_python_styleguide/_cli.py | Adithyak1998/python-styleguide | 86f162304607bbc583bec35e3e8b706b4cfa16f8 | [
"MIT"
] | 41 | 2020-08-07T14:58:12.000Z | 2022-02-28T13:44:02.000Z | ni_python_styleguide/_cli.py | Adithyak1998/python-styleguide | 86f162304607bbc583bec35e3e8b706b4cfa16f8 | [
"MIT"
] | 10 | 2020-08-26T21:03:32.000Z | 2021-12-14T14:03:19.000Z | import contextlib
import logging
import pathlib
from io import StringIO
import click
import flake8.main.application
import toml
from ni_python_styleguide import _acknowledge_existing_errors
def _get_application_import_names(pyproject):
"""Return the application package name the config."""
# Otherwise over... | 32.534091 | 96 | 0.645826 | import contextlib
import logging
import pathlib
from io import StringIO
import click
import flake8.main.application
import toml
from ni_python_styleguide import _acknowledge_existing_errors
def _qs_or_vs(verbosity):
if verbosity != 0:
return f"-{'v' * verbosity if verbosity > 0 else 'q' * abs(verbosity)... | 1,628 | 0 | 69 |
d4d59cd3831e6c9d543a9b2b68320d0d113b17d3 | 79 | py | Python | module_test.py | dldldlfma/py_tutorial | efb3ddb4d2fcd26e7086198fe42144d896623ed7 | [
"MIT"
] | null | null | null | module_test.py | dldldlfma/py_tutorial | efb3ddb4d2fcd26e7086198fe42144d896623ed7 | [
"MIT"
] | null | null | null | module_test.py | dldldlfma/py_tutorial | efb3ddb4d2fcd26e7086198fe42144d896623ed7 | [
"MIT"
] | 1 | 2019-10-08T09:07:38.000Z | 2019-10-08T09:07:38.000Z | print_hello()
print_hello()
print_hello() | 15.8 | 18 | 0.721519 | def print_hello():
print("Hello")
print_hello()
print_hello()
print_hello() | 16 | 0 | 22 |
72f26b83eefbceeb94a7efc7fd4d4694cf869f52 | 8,810 | py | Python | hpccm/building_blocks/boost.py | adegomme/hpc-container-maker | fc397482f324af9b0571f235cb51ad9d2939f1c5 | [
"Apache-2.0"
] | 340 | 2018-03-26T00:11:21.000Z | 2022-03-21T03:04:27.000Z | hpccm/building_blocks/boost.py | adegomme/hpc-container-maker | fc397482f324af9b0571f235cb51ad9d2939f1c5 | [
"Apache-2.0"
] | 103 | 2018-03-24T04:34:24.000Z | 2022-03-31T18:49:57.000Z | hpccm/building_blocks/boost.py | adegomme/hpc-container-maker | fc397482f324af9b0571f235cb51ad9d2939f1c5 | [
"Apache-2.0"
] | 75 | 2018-05-10T15:42:11.000Z | 2022-03-28T16:51:14.000Z | # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | 38.982301 | 108 | 0.647333 | # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | 0 | 0 | 0 |
aeae54ae321174427717451daee60d75a3df30f2 | 5,933 | py | Python | geotrek/signage/views.py | GuillaumeBoitel/Geotrek-admin | f14895c33fc2fe192a7cda162036f689deaa51bb | [
"BSD-2-Clause"
] | null | null | null | geotrek/signage/views.py | GuillaumeBoitel/Geotrek-admin | f14895c33fc2fe192a7cda162036f689deaa51bb | [
"BSD-2-Clause"
] | null | null | null | geotrek/signage/views.py | GuillaumeBoitel/Geotrek-admin | f14895c33fc2fe192a7cda162036f689deaa51bb | [
"BSD-2-Clause"
] | null | null | null | from django.conf import settings
from django.http import HttpResponse
import logging
from mapentity.views import (MapEntityLayer, MapEntityList, MapEntityJsonList, MapEntityFormat, MapEntityViewSet,
MapEntityDetail, MapEntityDocument, MapEntityCreate, MapEntityUpdate, MapEntityDelete)
fro... | 31.727273 | 119 | 0.709085 | from django.conf import settings
from django.http import HttpResponse
import logging
from mapentity.views import (MapEntityLayer, MapEntityList, MapEntityJsonList, MapEntityFormat, MapEntityViewSet,
MapEntityDetail, MapEntityDocument, MapEntityCreate, MapEntityUpdate, MapEntityDelete)
fro... | 1,762 | 2,779 | 483 |
e9937b9d86d8b03d5e94df8ded099f1c0118703e | 2,254 | py | Python | cohesity_management_sdk/models/source_throttling_configuration.py | nick6655/management-sdk-python | 88e792cb83e5c24a22af495b220c145d0c45841d | [
"Apache-2.0"
] | 18 | 2019-09-24T17:35:53.000Z | 2022-03-25T08:08:47.000Z | cohesity_management_sdk/models/source_throttling_configuration.py | nick6655/management-sdk-python | 88e792cb83e5c24a22af495b220c145d0c45841d | [
"Apache-2.0"
] | 18 | 2019-03-29T19:32:29.000Z | 2022-01-03T23:16:45.000Z | cohesity_management_sdk/models/source_throttling_configuration.py | nick6655/management-sdk-python | 88e792cb83e5c24a22af495b220c145d0c45841d | [
"Apache-2.0"
] | 16 | 2019-02-27T06:54:12.000Z | 2021-11-16T18:10:24.000Z | # -*- coding: utf-8 -*-
# Copyright 2021 Cohesity Inc.
import cohesity_management_sdk.models.throttling_configuration
class SourceThrottlingConfiguration(object):
"""Implementation of the 'SourceThrottlingConfiguration' model.
Specifies the source side throttling configuration.
Attributes:
cpu_... | 36.354839 | 229 | 0.708518 | # -*- coding: utf-8 -*-
# Copyright 2021 Cohesity Inc.
import cohesity_management_sdk.models.throttling_configuration
class SourceThrottlingConfiguration(object):
"""Implementation of the 'SourceThrottlingConfiguration' model.
Specifies the source side throttling configuration.
Attributes:
cpu_... | 0 | 0 | 0 |
d4cd70efb18a9c272069b7b96bdcb0b488bff82d | 2,074 | py | Python | server/project/apps/core/migrations/0002_auto_20170116_0637.py | CalHoll/9001 | 7fe371346d4fefb7b2434262da67b7e1b18057e4 | [
"MIT"
] | 54 | 2017-01-20T20:05:23.000Z | 2022-02-02T12:34:33.000Z | server/project/apps/core/migrations/0002_auto_20170116_0637.py | CalHoll/9001 | 7fe371346d4fefb7b2434262da67b7e1b18057e4 | [
"MIT"
] | 104 | 2019-11-25T08:33:52.000Z | 2021-08-02T06:17:19.000Z | server/project/apps/core/migrations/0002_auto_20170116_0637.py | CalHoll/9001 | 7fe371346d4fefb7b2434262da67b7e1b18057e4 | [
"MIT"
] | 9 | 2017-01-26T05:56:01.000Z | 2018-05-15T16:50:19.000Z | # -*- coding: utf-8 -*-
# Generated by Django 1.9.12 on 2017-01-16 06:37
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
| 30.955224 | 114 | 0.53568 | # -*- coding: utf-8 -*-
# Generated by Django 1.9.12 on 2017-01-16 06:37
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('core', '0001_initial'),
]
operations = [
m... | 0 | 1,862 | 23 |
54ed365fe04c45b7d3259263da4cf543e2721d5f | 15,909 | py | Python | ev_ASMO.py | avinashmnit30/Electric-Vehicle-Optimal-Charging | 7f09bdbb9904285ddbbfeaa28cf402f7ef6f4cb4 | [
"BSD-3-Clause"
] | 7 | 2018-03-09T11:19:39.000Z | 2022-01-19T13:45:20.000Z | ev_ASMO.py | avinashmnit30/Electric-Vehicle-Optimal-Charging | 7f09bdbb9904285ddbbfeaa28cf402f7ef6f4cb4 | [
"BSD-3-Clause"
] | null | null | null | ev_ASMO.py | avinashmnit30/Electric-Vehicle-Optimal-Charging | 7f09bdbb9904285ddbbfeaa28cf402f7ef6f4cb4 | [
"BSD-3-Clause"
] | 1 | 2022-03-03T12:08:52.000Z | 2022-03-03T12:08:52.000Z | # -*- coding: utf-8 -*-
"""
Created on Tue Dec 22 09:02:23 2015
@author: Avinash
"""
import numpy as np
from numpy import *
import numpy
from math import *
import ev_charge_schedule_modification1 as ev
#import ev_charge_schedule.static as func1
#import ev_charge_schedule.dynamic as func2
import tim... | 45.454286 | 190 | 0.498397 | # -*- coding: utf-8 -*-
"""
Created on Tue Dec 22 09:02:23 2015
@author: Avinash
"""
import numpy as np
from numpy import *
import numpy
from math import *
import ev_charge_schedule_modification1 as ev
#import ev_charge_schedule.static as func1
#import ev_charge_schedule.dynamic as func2
import tim... | 2,782 | 0 | 50 |
e974a8af2a36fd2e6f2f0ee548b8c2b6659b4a2f | 168 | py | Python | factory-ai-vision/OVMSAdaptorEdgeSolution/send_config.py | michellechena/azure-intelligent-edge-patterns | b1260b962b208880532391e7ef2148d240f489f8 | [
"MIT"
] | null | null | null | factory-ai-vision/OVMSAdaptorEdgeSolution/send_config.py | michellechena/azure-intelligent-edge-patterns | b1260b962b208880532391e7ef2148d240f489f8 | [
"MIT"
] | null | null | null | factory-ai-vision/OVMSAdaptorEdgeSolution/send_config.py | michellechena/azure-intelligent-edge-patterns | b1260b962b208880532391e7ef2148d240f489f8 | [
"MIT"
] | null | null | null | import json
import requests
j = json.load(open('voe_config.json'))
js = json.dumps(j)
requests.post('http://YOUR_DEVICE_IP:8585/set_voe_config', json={'config': js})
| 21 | 79 | 0.732143 | import json
import requests
j = json.load(open('voe_config.json'))
js = json.dumps(j)
requests.post('http://YOUR_DEVICE_IP:8585/set_voe_config', json={'config': js})
| 0 | 0 | 0 |
3da19e896adc58f4fe4f96e1610b8a380ae10a1d | 3,066 | py | Python | pptx_template/cli.py | TRANTANKHOA/pptx-template | 6f756359641278e1aecb7e04abcbed01cc20826c | [
"Apache-2.0"
] | 73 | 2017-06-23T08:58:37.000Z | 2022-03-30T05:01:03.000Z | pptx_template/cli.py | TRANTANKHOA/pptx-template | 6f756359641278e1aecb7e04abcbed01cc20826c | [
"Apache-2.0"
] | 26 | 2017-06-08T01:45:36.000Z | 2021-09-23T19:13:40.000Z | pptx_template/cli.py | TRANTANKHOA/pptx-template | 6f756359641278e1aecb7e04abcbed01cc20826c | [
"Apache-2.0"
] | 23 | 2017-07-05T02:29:21.000Z | 2022-01-18T00:50:30.000Z | # pptx-template - import csv to powerpoint template
# coding=utf-8
import sys
import codecs
import logging
import argparse
import json
import shutil
import os
import tempfile
import openpyxl as xl
from io import open, TextIOWrapper
from pptx import Presentation
from six import iteritems
from itertools import islice
... | 34.449438 | 126 | 0.691129 | # pptx-template - import csv to powerpoint template
# coding=utf-8
import sys
import codecs
import logging
import argparse
import json
import shutil
import os
import tempfile
import openpyxl as xl
from io import open, TextIOWrapper
from pptx import Presentation
from six import iteritems
from itertools import islice
... | 2,305 | 0 | 69 |
090960c2130756d68c64e5fa7c9ade129991c783 | 792 | py | Python | isscloudtools/gmail.py | elistavitski/issgoogletools | fd3eec16f19ffec8c01731acd9ebf9332d52f2c1 | [
"BSD-3-Clause"
] | null | null | null | isscloudtools/gmail.py | elistavitski/issgoogletools | fd3eec16f19ffec8c01731acd9ebf9332d52f2c1 | [
"BSD-3-Clause"
] | null | null | null | isscloudtools/gmail.py | elistavitski/issgoogletools | fd3eec16f19ffec8c01731acd9ebf9332d52f2c1 | [
"BSD-3-Clause"
] | null | null | null | from email.mime.text import MIMEText
import base64
| 33 | 98 | 0.686869 | from email.mime.text import MIMEText
import base64
def create_html_message(sender, to, subject, message_text):
message = MIMEText(message_text,'html')
message['to'] = to
message['from'] = sender
message['subject'] = subject
#return message
return {'raw': base64.urlsafe_b64encode(message.as_str... | 669 | 0 | 69 |
a60ce427dc8f1f22f6db87c975a839aae9f1e36d | 20,280 | py | Python | tests/analysis/test_location_identification.py | RhnSharma/trackintel | 33d6205475ad8c4a859a9a5883241fe1098997b2 | [
"MIT"
] | null | null | null | tests/analysis/test_location_identification.py | RhnSharma/trackintel | 33d6205475ad8c4a859a9a5883241fe1098997b2 | [
"MIT"
] | null | null | null | tests/analysis/test_location_identification.py | RhnSharma/trackintel | 33d6205475ad8c4a859a9a5883241fe1098997b2 | [
"MIT"
] | null | null | null | import datetime
import geopandas as gpd
import numpy as np
import pandas as pd
import pytest
import trackintel as ti
from geopandas.testing import assert_geodataframe_equal
from pandas.testing import assert_frame_equal, assert_index_equal
from shapely.geometry import Point
from trackintel.analysis.location_identificat... | 43.612903 | 114 | 0.634813 | import datetime
import geopandas as gpd
import numpy as np
import pandas as pd
import pytest
import trackintel as ti
from geopandas.testing import assert_geodataframe_equal
from pandas.testing import assert_frame_equal, assert_index_equal
from shapely.geometry import Point
from trackintel.analysis.location_identificat... | 441 | 0 | 49 |
19741c2152941b46f43a6bcbc7448df3695d359f | 621 | py | Python | jacdac/power_supply/constants.py | microsoft/jacdac-python | 712ad5559e29065f5eccb5dbfe029c039132df5a | [
"MIT"
] | 1 | 2022-02-15T21:30:36.000Z | 2022-02-15T21:30:36.000Z | jacdac/power_supply/constants.py | microsoft/jacdac-python | 712ad5559e29065f5eccb5dbfe029c039132df5a | [
"MIT"
] | null | null | null | jacdac/power_supply/constants.py | microsoft/jacdac-python | 712ad5559e29065f5eccb5dbfe029c039132df5a | [
"MIT"
] | 1 | 2022-02-08T19:32:45.000Z | 2022-02-08T19:32:45.000Z | # Autogenerated constants for Power supply service
from jacdac.constants import *
from jacdac.system.constants import *
JD_SERVICE_CLASS_POWER_SUPPLY = const(0x1f40375f)
JD_POWER_SUPPLY_REG_ENABLED = const(JD_REG_INTENSITY)
JD_POWER_SUPPLY_REG_OUTPUT_VOLTAGE = const(JD_REG_VALUE)
JD_POWER_SUPPLY_REG_MINIMUM_VOLTAGE = c... | 41.4 | 61 | 0.8438 | # Autogenerated constants for Power supply service
from jacdac.constants import *
from jacdac.system.constants import *
JD_SERVICE_CLASS_POWER_SUPPLY = const(0x1f40375f)
JD_POWER_SUPPLY_REG_ENABLED = const(JD_REG_INTENSITY)
JD_POWER_SUPPLY_REG_OUTPUT_VOLTAGE = const(JD_REG_VALUE)
JD_POWER_SUPPLY_REG_MINIMUM_VOLTAGE = c... | 0 | 0 | 0 |
e4af2d93ef4f403d93c85fac08d930e606320bf9 | 7,569 | py | Python | loadtests/discussions_api/seed_data/discussions_seeder.py | cmltaWt0/edx-load-tests | c25547a3ee241b3aa323dc6931e161a356ed5314 | [
"Apache-2.0"
] | 18 | 2016-01-31T13:29:56.000Z | 2019-02-08T18:08:49.000Z | loadtests/discussions_api/seed_data/discussions_seeder.py | cmltaWt0/edx-load-tests | c25547a3ee241b3aa323dc6931e161a356ed5314 | [
"Apache-2.0"
] | 92 | 2015-07-31T20:16:51.000Z | 2019-08-09T14:32:12.000Z | loadtests/discussions_api/seed_data/discussions_seeder.py | cmltaWt0/edx-load-tests | c25547a3ee241b3aa323dc6931e161a356ed5314 | [
"Apache-2.0"
] | 15 | 2015-08-19T15:23:58.000Z | 2018-02-01T19:47:38.000Z | import json
import time
import urllib
from seeder import Seeder
class PostCreationException(Exception):
"""Raised when the creation of a post fails"""
pass
| 39.015464 | 179 | 0.580526 | import json
import time
import urllib
from seeder import Seeder
class PostCreationException(Exception):
"""Raised when the creation of a post fails"""
pass
class DiscussionsSeeder(Seeder):
def __init__(self,
course_id=None,
lms_url=None):
super(DiscussionsSeed... | 2,158 | 5,220 | 23 |
b21bda93051987ca0e5335b33e5d4de6709a7454 | 379 | py | Python | powerset.py | ctsan/powersets | f722ef965489072147e4486ba4b5ea274c964597 | [
"MIT"
] | null | null | null | powerset.py | ctsan/powersets | f722ef965489072147e4486ba4b5ea274c964597 | [
"MIT"
] | null | null | null | powerset.py | ctsan/powersets | f722ef965489072147e4486ba4b5ea274c964597 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
from itertools import combinations
from sys import argv
initial_set = set(argv[1:])
final_set = set()
for i in range( len(initial_set) + 1 ):
final_set |= set ( combinations( initial_set, i) )
set_printer("S",initial_set)
set_printer("P(S)",final_set)
| 21.055556 | 58 | 0.654354 | #!/usr/bin/env python
from itertools import combinations
from sys import argv
def set_printer(name,s):
l = list(s)
print(name, " = " ,sorted(l, key=len))
initial_set = set(argv[1:])
final_set = set()
for i in range( len(initial_set) + 1 ):
final_set |= set ( combinations( initial_set, i) )
... | 70 | 0 | 23 |
d8634f6a60eb6a37cd6c93a8f0c909c9ca2e6b5e | 1,255 | py | Python | main.py | trdvangraft/dataviz | 2e8861c942dd57a56263637cb03d247fb9c3f891 | [
"MIT"
] | null | null | null | main.py | trdvangraft/dataviz | 2e8861c942dd57a56263637cb03d247fb9c3f891 | [
"MIT"
] | null | null | null | main.py | trdvangraft/dataviz | 2e8861c942dd57a56263637cb03d247fb9c3f891 | [
"MIT"
] | null | null | null | import pandas as pd
if __name__ == "__main__":
pre_crisis_years = list(range(2000, 2008))
crisis_years = list(range(2008, 2012))
post_crisis_years = list(range(2013, 2016))
df = get_divorce_data()
pre_crisis_df = get_mariage_information(df, pre_crisis_years, "pre_crisis_years")
crisis_df = g... | 36.911765 | 128 | 0.700398 | import pandas as pd
def get_divorce_data():
return pd.read_csv("./data/yearly_divorces.csv", delimiter=";", header=[0], index_col=[0, 1])
def get_mariage_information(df, period, period_name):
period_df = df[(df.index.get_level_values('Perioden') >= period[0]) & (df.index.get_level_values('Perioden') >= perio... | 459 | 0 | 46 |
95362fc6a641489662dce69f746ae816e1f9edbc | 1,339 | py | Python | wishlist/views.py | pmaigutyak/mp-shop-wishlist | 0b3afb451cd538e460b052fbbd6b7570d7769b02 | [
"0BSD"
] | 2 | 2018-03-14T11:32:36.000Z | 2021-09-25T14:31:36.000Z | wishlist/views.py | pmaigutyak/mp-shop | 14ea67f71fd91a282d2070414924708214fc6464 | [
"0BSD"
] | null | null | null | wishlist/views.py | pmaigutyak/mp-shop | 14ea67f71fd91a282d2070414924708214fc6464 | [
"0BSD"
] | 1 | 2021-04-10T18:51:47.000Z | 2021-04-10T18:51:47.000Z |
from django.apps import apps
from django.shortcuts import get_object_or_404, redirect
from django.contrib import messages
from django.utils.translation import ugettext_lazy as _
from django.contrib.auth.decorators import login_required
from wishlist.exceptions import ProductAlreadyAdded, ItemDoesNotExists
@login_re... | 29.755556 | 70 | 0.706497 |
from django.apps import apps
from django.shortcuts import get_object_or_404, redirect
from django.contrib import messages
from django.utils.translation import ugettext_lazy as _
from django.contrib.auth.decorators import login_required
from wishlist.exceptions import ProductAlreadyAdded, ItemDoesNotExists
@login_re... | 950 | 0 | 44 |
8043038c267e6f0b8dac7db3e45758753a4ca7fc | 9,695 | py | Python | src/vqa/train/train_vqa.py | GuessWhatGame/vqa | c9b8bf97a66ff4d5bf1d147501b0b7220de2f120 | [
"Apache-2.0"
] | 14 | 2017-10-08T14:54:13.000Z | 2021-12-28T08:25:36.000Z | src/vqa/train/train_vqa.py | GuessWhatGame/vqa | c9b8bf97a66ff4d5bf1d147501b0b7220de2f120 | [
"Apache-2.0"
] | 1 | 2019-03-14T13:29:36.000Z | 2019-03-14T13:29:36.000Z | src/vqa/train/train_vqa.py | GuessWhatGame/vqa | c9b8bf97a66ff4d5bf1d147501b0b7220de2f120 | [
"Apache-2.0"
] | 2 | 2020-04-08T02:42:33.000Z | 2020-09-24T11:24:37.000Z | import argparse
import logging
import os
import tensorflow as tf
from distutils.util import strtobool
from multiprocessing import Pool
from multiprocessing.pool import ThreadPool
from generic.data_provider.iterator import Iterator
from generic.tf_utils.evaluator import Evaluator, MultiGPUEvaluator
from generic.tf_uti... | 41.609442 | 149 | 0.691078 | import argparse
import logging
import os
import tensorflow as tf
from distutils.util import strtobool
from multiprocessing import Pool
from multiprocessing.pool import ThreadPool
from generic.data_provider.iterator import Iterator
from generic.tf_utils.evaluator import Evaluator, MultiGPUEvaluator
from generic.tf_uti... | 0 | 0 | 0 |
359a0c05915e60e02083efa75833f95d7f11d6bb | 5,378 | py | Python | bot/cogs/fun.py | ItsDrike/CommandBot | b7409ada15d0b692e9e123a81181c6e99685d755 | [
"MIT"
] | 1 | 2020-04-24T14:00:00.000Z | 2020-04-24T14:00:00.000Z | bot/cogs/fun.py | ItsDrike/CommandBot | b7409ada15d0b692e9e123a81181c6e99685d755 | [
"MIT"
] | 36 | 2020-05-22T03:28:49.000Z | 2020-10-02T21:37:23.000Z | bot/cogs/fun.py | itsdrike/CommandBot | b7409ada15d0b692e9e123a81181c6e99685d755 | [
"MIT"
] | 2 | 2020-09-12T10:11:03.000Z | 2020-09-15T14:39:24.000Z | import re
from random import randint, choice
from discord import Color, Embed
from discord.ext.commands import Cog, Context, command
import aiohttp
from bot import constants
from bot.bot import Bot
from bot.converters import DiceThrow
class Fun(Cog):
"""
A cog for built solely for fun
"""
roll_pat... | 35.381579 | 93 | 0.527334 | import re
from random import randint, choice
from discord import Color, Embed
from discord.ext.commands import Cog, Context, command
import aiohttp
from bot import constants
from bot.bot import Bot
from bot.converters import DiceThrow
class Fun(Cog):
"""
A cog for built solely for fun
"""
roll_pat... | 81 | 0 | 27 |
d41eea9967df3a280503c3877bfe4c98346777dc | 786 | py | Python | bumblebee/profiles/signals.py | sthasam2/bumblebee-backend | 22057399f34cdc1edb0ef04e622c97df46532de3 | [
"Linux-OpenIB"
] | null | null | null | bumblebee/profiles/signals.py | sthasam2/bumblebee-backend | 22057399f34cdc1edb0ef04e622c97df46532de3 | [
"Linux-OpenIB"
] | null | null | null | bumblebee/profiles/signals.py | sthasam2/bumblebee-backend | 22057399f34cdc1edb0ef04e622c97df46532de3 | [
"Linux-OpenIB"
] | null | null | null | from django.contrib.contenttypes.models import ContentType
from django.db.models.signals import post_save
from django.dispatch import receiver
from bumblebee.activities.models import UserActivity
from bumblebee.activities.utils import _create_activity
from config.definitions import DEBUG
from .models import Profile
... | 26.2 | 59 | 0.71374 | from django.contrib.contenttypes.models import ContentType
from django.db.models.signals import post_save
from django.dispatch import receiver
from bumblebee.activities.models import UserActivity
from bumblebee.activities.utils import _create_activity
from config.definitions import DEBUG
from .models import Profile
... | 0 | 0 | 0 |
04eefe5dd73d24179c71d7340fbb95bc334a2d8b | 354 | py | Python | examples/random_number_generator.py | gugarosa/py4research | de9acf2c2766cf1433bda05be89dfe862c8f5f5b | [
"MIT"
] | 2 | 2021-12-01T13:09:44.000Z | 2021-12-01T13:30:55.000Z | examples/random_number_generator.py | gugarosa/py4research | de9acf2c2766cf1433bda05be89dfe862c8f5f5b | [
"MIT"
] | null | null | null | examples/random_number_generator.py | gugarosa/py4research | de9acf2c2766cf1433bda05be89dfe862c8f5f5b | [
"MIT"
] | null | null | null | import py4research.math.random as r
# Generates an integer random number array
i = r.generate_integer_random_number(low=0, high=100, size=10)
print(f'Shape: {i.shape}')
print(f'Value: {i}')
# Generates a random gaussian number array
g = r.generate_gaussian_random_number(mean=0.5, variance=1.0, size=10)
print(f'Shape:... | 29.5 | 70 | 0.740113 | import py4research.math.random as r
# Generates an integer random number array
i = r.generate_integer_random_number(low=0, high=100, size=10)
print(f'Shape: {i.shape}')
print(f'Value: {i}')
# Generates a random gaussian number array
g = r.generate_gaussian_random_number(mean=0.5, variance=1.0, size=10)
print(f'Shape:... | 0 | 0 | 0 |
14a52cc501573b68eb32586999e9cc5aeba1fa68 | 2,339 | py | Python | examples/repr.py | crowsonkb/pyparsing-highlighting | 907cc715483cb19a0beee9e3edc5443909823e98 | [
"MIT"
] | 5 | 2019-01-28T08:43:37.000Z | 2022-01-18T23:12:32.000Z | examples/repr.py | crowsonkb/pyparsing-highlighting | 907cc715483cb19a0beee9e3edc5443909823e98 | [
"MIT"
] | null | null | null | examples/repr.py | crowsonkb/pyparsing-highlighting | 907cc715483cb19a0beee9e3edc5443909823e98 | [
"MIT"
] | 2 | 2019-02-20T12:30:46.000Z | 2022-01-09T23:12:42.000Z | """A Python repr() syntax highlighter."""
from prompt_toolkit.styles import Style
import pyparsing as pp
from pyparsing import pyparsing_common as ppc
from .repl import repl
# pylint: disable=too-many-locals
def parser_factory(styler):
"""Builds the repr() parser."""
squo = styler('class:string', "'")
d... | 34.910448 | 85 | 0.633177 | """A Python repr() syntax highlighter."""
from prompt_toolkit.styles import Style
import pyparsing as pp
from pyparsing import pyparsing_common as ppc
from .repl import repl
# pylint: disable=too-many-locals
def parser_factory(styler):
"""Builds the repr() parser."""
squo = styler('class:string', "'")
d... | 0 | 0 | 0 |
2dc21f2ca9d6bae3f49ea34340750cef95613528 | 562 | py | Python | restapicall/utils.py | olo-dw/restapicall.py | 4f92635ddf6ac029501c917cabf1fb6f8a92d5f6 | [
"MIT"
] | null | null | null | restapicall/utils.py | olo-dw/restapicall.py | 4f92635ddf6ac029501c917cabf1fb6f8a92d5f6 | [
"MIT"
] | null | null | null | restapicall/utils.py | olo-dw/restapicall.py | 4f92635ddf6ac029501c917cabf1fb6f8a92d5f6 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# -*-coding:UTF-8 -*
#
# Olivier Locard
import urllib
| 19.37931 | 58 | 0.532028 | #!/usr/bin/env python
# -*-coding:UTF-8 -*
#
# Olivier Locard
import urllib
class Utils(object):
@staticmethod
def build_uri(endpoint, uri, args):
"""
Build the URL using the endpoint, uri and args.
:param endpoint: str
:param uri: tuple
:param args: dict
:ret... | 0 | 461 | 23 |
2500a8001e30053ec2e117af0ad5f6533705f9d5 | 33 | py | Python | tweerator/__init__.py | Parassharmaa/tweerator | 9ed281e05734ef3cb3532f56d18ff9450f5dde46 | [
"MIT"
] | null | null | null | tweerator/__init__.py | Parassharmaa/tweerator | 9ed281e05734ef3cb3532f56d18ff9450f5dde46 | [
"MIT"
] | null | null | null | tweerator/__init__.py | Parassharmaa/tweerator | 9ed281e05734ef3cb3532f56d18ff9450f5dde46 | [
"MIT"
] | null | null | null | from .tweerator import Tweerator
| 16.5 | 32 | 0.848485 | from .tweerator import Tweerator
| 0 | 0 | 0 |
720608546939ff795987558e272419f930922408 | 723 | py | Python | profiles_api/urls.py | Anoop4u777/profiles-rest-api | 6cf31a6c85dbcd00515e3e7373622469f63f94df | [
"MIT"
] | null | null | null | profiles_api/urls.py | Anoop4u777/profiles-rest-api | 6cf31a6c85dbcd00515e3e7373622469f63f94df | [
"MIT"
] | null | null | null | profiles_api/urls.py | Anoop4u777/profiles-rest-api | 6cf31a6c85dbcd00515e3e7373622469f63f94df | [
"MIT"
] | null | null | null | from django.urls import path, include
from rest_framework import routers
from profiles_api import views
router = routers.DefaultRouter()
router.register('hello-viewset', views.HelloViewSet, base_name='hello-viewset')
"""
In the below registerwe need not assign the base name as we
have defined it in the UserProfileV... | 31.434783 | 79 | 0.766252 | from django.urls import path, include
from rest_framework import routers
from profiles_api import views
router = routers.DefaultRouter()
router.register('hello-viewset', views.HelloViewSet, base_name='hello-viewset')
"""
In the below registerwe need not assign the base name as we
have defined it in the UserProfileV... | 0 | 0 | 0 |
f9f1ebc1bb009d16c1a66652446dfd60691e40b4 | 165 | py | Python | practicioner_bundle/ch15-neural_style/pyimagesearch/utils/__init__.py | romanroson/pis_code | 1221c39c23bec62ba419f9a324f88b0d8e5e4b5b | [
"MIT"
] | 1 | 2020-06-07T04:02:16.000Z | 2020-06-07T04:02:16.000Z | practicioner_bundle/ch15-neural_style/pyimagesearch/utils/__init__.py | romanroson/pis_code | 1221c39c23bec62ba419f9a324f88b0d8e5e4b5b | [
"MIT"
] | null | null | null | practicioner_bundle/ch15-neural_style/pyimagesearch/utils/__init__.py | romanroson/pis_code | 1221c39c23bec62ba419f9a324f88b0d8e5e4b5b | [
"MIT"
] | 2 | 2020-03-25T10:51:54.000Z | 2020-09-18T09:36:44.000Z | """Import custom utils packages
"""
from .captchahelper import preprocess
from .ranked import rank5_accuracy
__all__ = [
"preprocess",
"rank5_accuracy",
]
| 15 | 37 | 0.721212 | """Import custom utils packages
"""
from .captchahelper import preprocess
from .ranked import rank5_accuracy
__all__ = [
"preprocess",
"rank5_accuracy",
]
| 0 | 0 | 0 |
738759cfb85a1b2a33c3de5e1df59d74113098e8 | 5,755 | py | Python | osp/core/ontology/oclass_restriction.py | simphony/osp-core | 8adc93b8957eb93e82e8363565bed140fa1b36f8 | [
"BSD-3-Clause"
] | 17 | 2020-04-24T12:09:32.000Z | 2022-03-03T17:21:17.000Z | osp/core/ontology/oclass_restriction.py | simphony/osp-core | 8adc93b8957eb93e82e8363565bed140fa1b36f8 | [
"BSD-3-Clause"
] | 264 | 2020-07-18T23:27:30.000Z | 2022-03-25T15:39:22.000Z | osp/core/ontology/oclass_restriction.py | simphony/osp-core | 8adc93b8957eb93e82e8363565bed140fa1b36f8 | [
"BSD-3-Clause"
] | 4 | 2020-04-24T10:37:10.000Z | 2021-07-05T10:34:21.000Z | """Restrictions on on ontology classes."""
from enum import Enum
import rdflib
import logging
from rdflib.term import BNode
from osp.core.ontology.attribute import OntologyAttribute
from osp.core.ontology.relationship import OntologyRelationship
logger = logging.getLogger(__name__)
class QUANTIFIER(Enum):
"""Th... | 31.108108 | 77 | 0.621894 | """Restrictions on on ontology classes."""
from enum import Enum
import rdflib
import logging
from rdflib.term import BNode
from osp.core.ontology.attribute import OntologyAttribute
from osp.core.ontology.relationship import OntologyRelationship
logger = logging.getLogger(__name__)
class QUANTIFIER(Enum):
"""Th... | 0 | 0 | 0 |
0ec4e59f27a8848f0f11c575c0ea9d38b2a2092b | 11,930 | py | Python | utils/optimization.py | nghoanglong/text2sql-lgesql | 7526d8a771bea8eb87f936cfb21050badb4c290f | [
"Apache-2.0"
] | 59 | 2021-06-02T13:30:06.000Z | 2022-03-22T10:06:38.000Z | utils/optimization.py | nghoanglong/text2sql-lgesql | 7526d8a771bea8eb87f936cfb21050badb4c290f | [
"Apache-2.0"
] | 13 | 2021-06-16T03:32:58.000Z | 2022-03-22T07:34:47.000Z | utils/optimization.py | nghoanglong/text2sql-lgesql | 7526d8a771bea8eb87f936cfb21050badb4c290f | [
"Apache-2.0"
] | 15 | 2021-08-31T14:26:59.000Z | 2022-03-18T20:07:02.000Z | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
#
# 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/LICEN... | 48.893443 | 181 | 0.643336 | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
#
# 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/LICEN... | 5,350 | 0 | 184 |
c4aa69d54e80b8327f566a905333cc4dc42ce02d | 6,344 | py | Python | iconrpcserver/utils/icon_service/templates.py | icon-project/icon-rpc-server | ece07a48cfe987c35a583c81ee5e063c75c90a89 | [
"Apache-2.0"
] | 15 | 2018-08-24T06:00:09.000Z | 2021-07-16T22:12:58.000Z | iconrpcserver/utils/icon_service/templates.py | icon-project/icon-rpc-server | ece07a48cfe987c35a583c81ee5e063c75c90a89 | [
"Apache-2.0"
] | 28 | 2018-10-16T04:46:00.000Z | 2021-12-15T03:36:31.000Z | iconrpcserver/utils/icon_service/templates.py | icon-project/icon-rpc-server | ece07a48cfe987c35a583c81ee5e063c75c90a89 | [
"Apache-2.0"
] | 22 | 2018-09-10T05:45:56.000Z | 2022-02-10T03:28:26.000Z | # Copyright 2018 ICON Foundation
#
# 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 writi... | 29.64486 | 102 | 0.67418 | # Copyright 2018 ICON Foundation
#
# 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 writi... | 0 | 0 | 0 |
76640fcd932c2e5fe81d1524f7e41c390ce05cec | 1,714 | py | Python | examples/log_requests.py | fajfer/aiohttp-client-cache | bf4bc563c5b5ac5869db576ac478852d4d55ab59 | [
"BSD-2-Clause",
"MIT"
] | 38 | 2020-11-14T04:23:32.000Z | 2022-03-25T09:10:40.000Z | examples/log_requests.py | fajfer/aiohttp-client-cache | bf4bc563c5b5ac5869db576ac478852d4d55ab59 | [
"BSD-2-Clause",
"MIT"
] | 83 | 2020-11-20T21:42:37.000Z | 2022-03-29T11:19:06.000Z | examples/log_requests.py | fajfer/aiohttp-client-cache | bf4bc563c5b5ac5869db576ac478852d4d55ab59 | [
"BSD-2-Clause",
"MIT"
] | 9 | 2020-11-20T21:44:06.000Z | 2022-03-18T11:21:15.000Z | #!/usr/bin/env python3
"""
An example of testing the cache to prove that it's not making more requests than expected.
"""
import asyncio
from contextlib import asynccontextmanager
from logging import basicConfig, getLogger
from unittest.mock import patch
from aiohttp import ClientSession
from aiohttp_client_cache imp... | 34.28 | 94 | 0.721704 | #!/usr/bin/env python3
"""
An example of testing the cache to prove that it's not making more requests than expected.
"""
import asyncio
from contextlib import asynccontextmanager
from logging import basicConfig, getLogger
from unittest.mock import patch
from aiohttp import ClientSession
from aiohttp_client_cache imp... | 115 | 0 | 27 |
1f2e66fdecad1edf9c14de73f8e9e4fa4de2abb6 | 11,292 | py | Python | woltka/tests/test_ordinal.py | emikoifish/woltka | e4207bba3550b75bb153c7d094d0b1a577a15bc4 | [
"BSD-3-Clause"
] | null | null | null | woltka/tests/test_ordinal.py | emikoifish/woltka | e4207bba3550b75bb153c7d094d0b1a577a15bc4 | [
"BSD-3-Clause"
] | null | null | null | woltka/tests/test_ordinal.py | emikoifish/woltka | e4207bba3550b75bb153c7d094d0b1a577a15bc4 | [
"BSD-3-Clause"
] | null | null | null | #!/usr/bin/env python3
# ----------------------------------------------------------------------------
# Copyright (c) 2020--, Qiyun Zhu.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------... | 36.781759 | 78 | 0.475381 | #!/usr/bin/env python3
# ----------------------------------------------------------------------------
# Copyright (c) 2020--, Qiyun Zhu.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------... | 10,252 | 8 | 292 |
9224f3ea01e3494877569ec6add7b8d068db206e | 1,192 | py | Python | scispack/tests/test_cli.py | fmaussion/scispack | c1edff8f3629b27af5b13f757f664ddde4a3260c | [
"Unlicense"
] | 3 | 2018-05-14T05:48:00.000Z | 2021-01-13T17:01:42.000Z | scispack/tests/test_cli.py | fmaussion/scispack | c1edff8f3629b27af5b13f757f664ddde4a3260c | [
"Unlicense"
] | null | null | null | scispack/tests/test_cli.py | fmaussion/scispack | c1edff8f3629b27af5b13f757f664ddde4a3260c | [
"Unlicense"
] | null | null | null | # Testing command line interfaces is hard. But we'll try
# At least we separated our actual program from the I/O part so that we
# can test that
import scispack
from scispack.cli import cli_program
| 22.923077 | 71 | 0.688758 | # Testing command line interfaces is hard. But we'll try
# At least we separated our actual program from the I/O part so that we
# can test that
import scispack
from scispack.cli import cli_program
def test_help(capsys):
# Check that with empty arguments we return the help
cli_program([])
captured = caps... | 874 | 0 | 115 |
8f43ea62b06053557b7d22482d67b2f234edcaff | 1,456 | py | Python | ff_pyomo.py | mlac/ff_2018 | 80db4835e48b1acfeb51bd732fd3cc89273da81e | [
"Apache-2.0"
] | null | null | null | ff_pyomo.py | mlac/ff_2018 | 80db4835e48b1acfeb51bd732fd3cc89273da81e | [
"Apache-2.0"
] | null | null | null | ff_pyomo.py | mlac/ff_2018 | 80db4835e48b1acfeb51bd732fd3cc89273da81e | [
"Apache-2.0"
] | null | null | null |
from pyomo.environ import *
infinity = float('inf')
model = AbstractModel()
#Players
model.P = Set()
#Expected Scoring
model.S = Set()
#value of each player
model.v = Param(model.P, within=PositiveReals)
#expected Positions for each player
model.e = Param(model.P,model.S, within=NonNegativeReals)
#Lower and uppe... | 24.266667 | 68 | 0.740385 |
from pyomo.environ import *
infinity = float('inf')
model = AbstractModel()
#Players
model.P = Set()
#Expected Scoring
model.S = Set()
#value of each player
model.v = Param(model.P, within=PositiveReals)
#expected Positions for each player
model.e = Param(model.P,model.S, within=NonNegativeReals)
#Lower and uppe... | 241 | 0 | 66 |
a8e3e7f36e96e9a39111172042e96f7cd7ab118a | 450 | py | Python | config.py | kelvinmuchui/football_data | 460d095a02bb2140aba18437d0a927858acd1dde | [
"MIT"
] | null | null | null | config.py | kelvinmuchui/football_data | 460d095a02bb2140aba18437d0a927858acd1dde | [
"MIT"
] | null | null | null | config.py | kelvinmuchui/football_data | 460d095a02bb2140aba18437d0a927858acd1dde | [
"MIT"
] | null | null | null | class Config(object):
"""
Common configurations
"""
#Put any configurations here that are common a close all enviroment
class DevelopmentConfig(Config):
"""
Development configurations
"""
DEBUG =True
SQLALCHEMY_ECHO =True
class ProductionConfig(Config):
"""
Production ... | 15.517241 | 72 | 0.664444 | class Config(object):
"""
Common configurations
"""
#Put any configurations here that are common a close all enviroment
class DevelopmentConfig(Config):
"""
Development configurations
"""
DEBUG =True
SQLALCHEMY_ECHO =True
class ProductionConfig(Config):
"""
Production ... | 0 | 0 | 0 |
b4236ba8710c85590213540db2522aebad65170e | 2,295 | py | Python | lg_replay/src/lg_replay/replay.py | carlosvquezada/lg_ros_nodes | 7560e99272d06ef5c80a5444131dad72c078a718 | [
"Apache-2.0"
] | 16 | 2015-10-10T11:55:37.000Z | 2022-02-24T22:47:48.000Z | lg_replay/src/lg_replay/replay.py | carlosvquezada/lg_ros_nodes | 7560e99272d06ef5c80a5444131dad72c078a718 | [
"Apache-2.0"
] | 292 | 2015-09-29T21:59:53.000Z | 2022-03-31T15:59:31.000Z | lg_replay/src/lg_replay/replay.py | constantegonzalez/lg_ros_nodes | 1c7b08c42e90205922602c86805285508d1b7971 | [
"Apache-2.0"
] | 5 | 2017-05-03T06:22:43.000Z | 2021-08-19T16:54:14.000Z | import rospy
from evdev import InputDevice, ecodes
from lg_common.helpers import rewrite_message_to_dict, find_device
from interactivespaces_msgs.msg import GenericMessage
class DeviceReplay:
"""
Initialized with device name
Needs a publisher to publish messages
"""
def __init__(self, publisher,... | 35.307692 | 103 | 0.644009 | import rospy
from evdev import InputDevice, ecodes
from lg_common.helpers import rewrite_message_to_dict, find_device
from interactivespaces_msgs.msg import GenericMessage
class LgActivityException(Exception):
pass
class DeviceReplay:
"""
Initialized with device name
Needs a publisher to publish me... | 675 | 25 | 103 |
de35582ee2c753e469342178d9a3b7f90b100e6b | 840 | py | Python | project/S17-IR-P016/code/spark1.py | suunni/sp17-i524 | 42dd11b914c03c741dad8a8505c3e091dc6ec412 | [
"Apache-2.0"
] | 2 | 2020-10-30T09:54:25.000Z | 2021-12-14T19:13:18.000Z | project/S17-IR-P016/code/spark1.py | cloudmesh/sp17-i524 | 42dd11b914c03c741dad8a8505c3e091dc6ec412 | [
"Apache-2.0"
] | 98 | 2017-01-19T04:24:02.000Z | 2017-10-27T11:30:50.000Z | project/S17-IR-P016/code/spark1.py | cloudmesh/sp17-i524 | 42dd11b914c03c741dad8a8505c3e091dc6ec412 | [
"Apache-2.0"
] | 294 | 2017-01-09T13:18:39.000Z | 2018-07-13T01:32:24.000Z | from pyspark import SparkConf
from pyspark import SparkContext
from pyspark.mllib.regression import LabeledPoint
from pyspark.mllib.tree import DecisionTree
conf = SparkConf()
conf.setMaster('spark://HEAD_NODE_HOSTNAME:7077')
conf.setAppName('spark-basic')
sc = SparkContext(conf=conf)
rdd = sc.parallelize(range(1000)... | 31.111111 | 77 | 0.679762 | from pyspark import SparkConf
from pyspark import SparkContext
from pyspark.mllib.regression import LabeledPoint
from pyspark.mllib.tree import DecisionTree
conf = SparkConf()
conf.setMaster('spark://HEAD_NODE_HOSTNAME:7077')
conf.setAppName('spark-basic')
sc = SparkContext(conf=conf)
def mod(x):
import numpy as ... | 152 | 0 | 46 |
bc96519e04351faa2853702d74b890a59160a434 | 689 | py | Python | sdk/python/pulumi_azure_native/policyinsights/v20190701/_enums.py | polivbr/pulumi-azure-native | 09571f3bf6bdc4f3621aabefd1ba6c0d4ecfb0e7 | [
"Apache-2.0"
] | null | null | null | sdk/python/pulumi_azure_native/policyinsights/v20190701/_enums.py | polivbr/pulumi-azure-native | 09571f3bf6bdc4f3621aabefd1ba6c0d4ecfb0e7 | [
"Apache-2.0"
] | null | null | null | sdk/python/pulumi_azure_native/policyinsights/v20190701/_enums.py | polivbr/pulumi-azure-native | 09571f3bf6bdc4f3621aabefd1ba6c0d4ecfb0e7 | [
"Apache-2.0"
] | null | null | null | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
from enum import Enum
__all__ = [
'ResourceDiscoveryMode',
]
class ResourceDiscoveryMode(str, Enum):
"""
The way resources to remediate ... | 34.45 | 115 | 0.728592 | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
from enum import Enum
__all__ = [
'ResourceDiscoveryMode',
]
class ResourceDiscoveryMode(str, Enum):
"""
The way resources to remediate ... | 0 | 0 | 0 |
5dc151582c42cc782a311a172925093be0d6274c | 432 | py | Python | heritage/migrations/0063_auto_20160718_2201.py | stewardshiptools/stewardshiptools | ee5d27e7b0d5d4947f34ad02bdf63a06ad0a5c3e | [
"MIT"
] | null | null | null | heritage/migrations/0063_auto_20160718_2201.py | stewardshiptools/stewardshiptools | ee5d27e7b0d5d4947f34ad02bdf63a06ad0a5c3e | [
"MIT"
] | 11 | 2020-03-24T15:29:46.000Z | 2022-03-11T23:14:48.000Z | heritage/migrations/0063_auto_20160718_2201.py | stewardshiptools/stewardshiptools | ee5d27e7b0d5d4947f34ad02bdf63a06ad0a5c3e | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
| 21.6 | 75 | 0.618056 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('heritage', '0062_auto_20160712_2030'),
]
operations = [
migrations.AlterField(
model_name='mtkrecord',
... | 0 | 302 | 23 |
b10c409d37bd6c961abe0854cee623b7e329a761 | 1,483 | py | Python | Chapter 3/03/recipe20b.py | robert0714/Python-Testing-Cookbook-Second-Edition | c7c5d59e42e9ca2874faf12a6dd201736a45ca83 | [
"MIT"
] | null | null | null | Chapter 3/03/recipe20b.py | robert0714/Python-Testing-Cookbook-Second-Edition | c7c5d59e42e9ca2874faf12a6dd201736a45ca83 | [
"MIT"
] | null | null | null | Chapter 3/03/recipe20b.py | robert0714/Python-Testing-Cookbook-Second-Edition | c7c5d59e42e9ca2874faf12a6dd201736a45ca83 | [
"MIT"
] | null | null | null | def convert_to_basen(value, base):
"""Convert a base10 number to basen.
>>> [convert_to_basen(i, 16) for i in range(1,16)] #doctest: +NORMALIZE_WHITESPACE
['1/16', '2/16', '3/16', '4/16', '5/16', '6/16', '7/16', '8/16',
'9/16', 'a/16', 'b/16', 'c/16', 'd/16', 'e/16', 'f/16']
FUTURE: Binary may s... | 32.23913 | 86 | 0.519218 | def convert_to_basen(value, base):
"""Convert a base10 number to basen.
>>> [convert_to_basen(i, 16) for i in range(1,16)] #doctest: +NORMALIZE_WHITESPACE
['1/16', '2/16', '3/16', '4/16', '5/16', '6/16', '7/16', '8/16',
'9/16', 'a/16', 'b/16', 'c/16', 'd/16', 'e/16', 'f/16']
FUTURE: Binary may s... | 664 | 0 | 27 |
75277665b2c875af9db7a796958b040e98ee18c7 | 57 | py | Python | Tsukihime/utilities/__init__.py | Samyuth/LomandoCrawler | 2d6bc7bd79678b78ac7c30e88b72127134e99b91 | [
"MIT"
] | null | null | null | Tsukihime/utilities/__init__.py | Samyuth/LomandoCrawler | 2d6bc7bd79678b78ac7c30e88b72127134e99b91 | [
"MIT"
] | 1 | 2022-03-31T09:40:48.000Z | 2022-03-31T09:44:48.000Z | Tsukihime/utilities/__init__.py | Samyuth/LomandoCrawler | 2d6bc7bd79678b78ac7c30e88b72127134e99b91 | [
"MIT"
] | null | null | null | from . import encoding_tester
from . import html_compiler | 28.5 | 29 | 0.842105 | from . import encoding_tester
from . import html_compiler | 0 | 0 | 0 |
944d2e1eb4378185524847145b0d9d6336d5eaa8 | 2,081 | py | Python | tradingdb/gnosis/utils.py | gnosis/gnosisdb | b3055406fba7061c3677bfd16e19f8bc5c97db2c | [
"MIT"
] | 11 | 2017-06-23T15:35:10.000Z | 2018-04-27T06:11:25.000Z | tradingdb/gnosis/utils.py | gnosis/gnosisdb | b3055406fba7061c3677bfd16e19f8bc5c97db2c | [
"MIT"
] | 42 | 2018-01-17T15:46:33.000Z | 2018-05-08T08:13:17.000Z | tradingdb/gnosis/utils.py | gnosis/gnosisdb | b3055406fba7061c3677bfd16e19f8bc5c97db2c | [
"MIT"
] | 12 | 2017-07-03T15:51:41.000Z | 2018-03-25T17:31:54.000Z | from mpmath import mp, mpf
def remove_null_values(obj):
"""
Remove all null values from a dictionary
:param obj: dictionary
:return: filtered dictionary
"""
if not isinstance(obj, dict):
return obj
for k in list(obj.keys()):
_obj = obj[k]
if _obj is None:
... | 24.77381 | 95 | 0.629986 | from mpmath import mp, mpf
def singleton(clazz):
instances = {}
def getinstance(*args, **kwargs):
if clazz not in instances:
instances[clazz] = clazz(*args, **kwargs)
return instances[clazz]
return getinstance
class SingletonObject:
_instances = {}
def __new__(cls, ... | 1,088 | 48 | 138 |
a535ed615045bbd06beb82fa2536f0065964aa3b | 13,666 | py | Python | adversarial_mask_rcnn/adversarial_attack.py | Mctigger/adversarial-object-segmentation | 3f633f068bbb71c7ef459cf8528738ccbbbe36a1 | [
"MIT"
] | null | null | null | adversarial_mask_rcnn/adversarial_attack.py | Mctigger/adversarial-object-segmentation | 3f633f068bbb71c7ef459cf8528738ccbbbe36a1 | [
"MIT"
] | null | null | null | adversarial_mask_rcnn/adversarial_attack.py | Mctigger/adversarial-object-segmentation | 3f633f068bbb71c7ef459cf8528738ccbbbe36a1 | [
"MIT"
] | 1 | 2021-09-19T18:38:45.000Z | 2021-09-19T18:38:45.000Z | import os
import sys
sys.path.append('modules/pytorch_mask_rcnn')
import numpy as np
import torch
import matplotlib.pyplot as plt
from torch.autograd import Variable
from torch.autograd.gradcheck import zero_gradients
from model import Dataset, unmold_image, MaskRCNN, compute_losses
from visualize import display_inst... | 40.076246 | 149 | 0.597688 | import os
import sys
sys.path.append('modules/pytorch_mask_rcnn')
import numpy as np
import torch
import matplotlib.pyplot as plt
from torch.autograd import Variable
from torch.autograd.gradcheck import zero_gradients
from model import Dataset, unmold_image, MaskRCNN, compute_losses
from visualize import display_inst... | 6,069 | 0 | 46 |
ea40b4605a20ca5cbcd265e241e9ddb25c49e70f | 2,993 | py | Python | djsani/medical_history/waivers/forms.py | carthage-college/django-djsani | e344fd636695682a0765fc5d5c2137fe3e6b35d1 | [
"BSD-3-Clause"
] | 1 | 2017-04-22T11:08:41.000Z | 2017-04-22T11:08:41.000Z | djsani/medical_history/waivers/forms.py | carthage-college/django-djsani | e344fd636695682a0765fc5d5c2137fe3e6b35d1 | [
"BSD-3-Clause"
] | 10 | 2020-06-11T14:22:47.000Z | 2021-07-08T14:05:27.000Z | djsani/medical_history/waivers/forms.py | carthage-college/django-djsani | e344fd636695682a0765fc5d5c2137fe3e6b35d1 | [
"BSD-3-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
"""Forms for medical history."""
from django import forms
from django.conf import settings
from django.core.validators import FileExtensionValidator
from djtools.fields import BINARY_CHOICES
SICKLE_CELL_RESULTS = (
('Positive', 'Positive'),
('Negative', 'Negative'),
)
DRUG_TEST_RESUL... | 26.723214 | 80 | 0.646174 | # -*- coding: utf-8 -*-
"""Forms for medical history."""
from django import forms
from django.conf import settings
from django.core.validators import FileExtensionValidator
from djtools.fields import BINARY_CHOICES
SICKLE_CELL_RESULTS = (
('Positive', 'Positive'),
('Negative', 'Negative'),
)
DRUG_TEST_RESUL... | 0 | 0 | 0 |
7f5d878260aa516cb3a62e17639bd79949a427a3 | 847 | py | Python | packtml/regression/tests/test_simple_logistic.py | cicorias/supv-ml-py | f7e030206efe5bb2c49433ae18e115ca0fcfc5cb | [
"MIT"
] | 14 | 2018-08-22T22:12:40.000Z | 2021-10-04T16:28:14.000Z | packtml/regression/tests/test_simple_logistic.py | cicorias/supv-ml-py | f7e030206efe5bb2c49433ae18e115ca0fcfc5cb | [
"MIT"
] | null | null | null | packtml/regression/tests/test_simple_logistic.py | cicorias/supv-ml-py | f7e030206efe5bb2c49433ae18e115ca0fcfc5cb | [
"MIT"
] | 14 | 2018-05-31T20:42:12.000Z | 2021-09-15T08:00:14.000Z | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from packtml.regression import SimpleLogisticRegression
from sklearn.datasets import make_classification
from sklearn.metrics import accuracy_score
import numpy as np
X, y = make_classification(n_samples=100, n_features=2, random_state=42,
... | 30.25 | 72 | 0.700118 | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from packtml.regression import SimpleLogisticRegression
from sklearn.datasets import make_classification
from sklearn.metrics import accuracy_score
import numpy as np
X, y = make_classification(n_samples=100, n_features=2, random_state=42,
... | 405 | 0 | 23 |
54358a56a8ac6ba990a883c781ac68707b3b4e35 | 2,255 | py | Python | pupa/tests/test_disclosure_scrape.py | influence-usa/pupa | 5105c39a535ad401f7babe4eecb3861bed1f8326 | [
"BSD-3-Clause"
] | null | null | null | pupa/tests/test_disclosure_scrape.py | influence-usa/pupa | 5105c39a535ad401f7babe4eecb3861bed1f8326 | [
"BSD-3-Clause"
] | 3 | 2015-06-09T19:22:50.000Z | 2015-06-09T21:41:22.000Z | pupa/tests/test_disclosure_scrape.py | influence-usa/pupa | 5105c39a535ad401f7babe4eecb3861bed1f8326 | [
"BSD-3-Clause"
] | null | null | null | import pytest
import datetime
from pupa.scrape import Disclosure as ScrapeDisclosure
| 21.47619 | 83 | 0.635033 | import pytest
import datetime
from pupa.scrape import Disclosure as ScrapeDisclosure
def disclosure_obj():
disclosure = ScrapeDisclosure(
classification="lobbying",
effective_date=datetime.datetime(2011, 1, 22, 0, 0, 0),
submitted_date=datetime.datetime(2011, 3, 13, 0, 0, 0),
timez... | 1,978 | 0 | 184 |
eddfa0534c2bfe0f1262d3b344218c7437aaf008 | 544 | py | Python | source/pkgsrc/lang/python27/patches/patch-Lib_plistlib.py | Scottx86-64/dotfiles-1 | 51004b1e2b032664cce6b553d2052757c286087d | [
"Unlicense"
] | 1 | 2021-11-20T22:46:39.000Z | 2021-11-20T22:46:39.000Z | source/pkgsrc/lang/python27/patches/patch-Lib_plistlib.py | Scottx86-64/dotfiles-1 | 51004b1e2b032664cce6b553d2052757c286087d | [
"Unlicense"
] | null | null | null | source/pkgsrc/lang/python27/patches/patch-Lib_plistlib.py | Scottx86-64/dotfiles-1 | 51004b1e2b032664cce6b553d2052757c286087d | [
"Unlicense"
] | null | null | null | $NetBSD: patch-Lib_plistlib.py,v 1.1 2018/06/17 19:21:21 adam Exp $
Add ability to parse unsigned integers as externalized by NetBSD proplib(3).
--- Lib/plistlib.py.orig 2014-12-10 15:59:39.000000000 +0000
+++ Lib/plistlib.py
- self.addObject(int(self.getData()))
+ self.addObject(int(self.getData(), 0))... | 34 | 76 | 0.663603 | $NetBSD: patch-Lib_plistlib.py,v 1.1 2018/06/17 19:21:21 adam Exp $
Add ability to parse unsigned integers as externalized by NetBSD proplib(3).
--- Lib/plistlib.py.orig 2014-12-10 15:59:39.000000000 +0000
+++ Lib/plistlib.py
@@ -463,7 +463,7 @@ class PlistParser:
def end_false(self):
self.addObject(Fal... | 76 | -3 | 150 |
b97a478abd16dc35e10e8d832f79d1c0fc7d358c | 1,658 | py | Python | tests/parser/functions/test_abi.py | gsmadi/vyper | a0727419e850fb5ef6d3b4661c156554bd1c5b17 | [
"MIT"
] | null | null | null | tests/parser/functions/test_abi.py | gsmadi/vyper | a0727419e850fb5ef6d3b4661c156554bd1c5b17 | [
"MIT"
] | null | null | null | tests/parser/functions/test_abi.py | gsmadi/vyper | a0727419e850fb5ef6d3b4661c156554bd1c5b17 | [
"MIT"
] | null | null | null | from vyper.compiler import (
compile_codes,
mk_full_signature,
)
| 17.270833 | 58 | 0.550663 | from vyper.compiler import (
compile_codes,
mk_full_signature,
)
def test_only_init_function():
code = """
x: int128
@public
def __init__():
self.x = 1
"""
code_init_empty = """
x: int128
@public
def __init__():
pass
"""
empty_sig = [{
'outputs': [],
'inputs': []... | 1,489 | 0 | 92 |
1d5633b8a3a1630ba3e9a1a960d928819c0756e0 | 791 | py | Python | Second-handtradingplatform/TradingPlatform/account/urls.py | shangyajun6943/Second-hand | b8c423eeb559aed67856fb8a9f7130793d028118 | [
"Apache-2.0"
] | null | null | null | Second-handtradingplatform/TradingPlatform/account/urls.py | shangyajun6943/Second-hand | b8c423eeb559aed67856fb8a9f7130793d028118 | [
"Apache-2.0"
] | null | null | null | Second-handtradingplatform/TradingPlatform/account/urls.py | shangyajun6943/Second-hand | b8c423eeb559aed67856fb8a9f7130793d028118 | [
"Apache-2.0"
] | null | null | null | from django.urls import path
from . import views
app_name='account'
urlpatterns = [
path('login', views.login,name='login'),
path('login/*/', views.login,name='login2'),
path('register', views.register,name='register'),
path('conact', views.conact,name='conact'),
path('do_register',views.do_regist... | 39.55 | 79 | 0.724399 | from django.urls import path
from . import views
app_name='account'
urlpatterns = [
path('login', views.login,name='login'),
path('login/*/', views.login,name='login2'),
path('register', views.register,name='register'),
path('conact', views.conact,name='conact'),
path('do_register',views.do_regist... | 0 | 0 | 0 |
b45d3c2f5b636e494def73e345cb81de739ec7a2 | 771 | py | Python | 2016/day06.py | XtinaSchelin/adventofcode | 41aa36c8226310ab35a61703cba6b8bbbffe8281 | [
"MIT"
] | null | null | null | 2016/day06.py | XtinaSchelin/adventofcode | 41aa36c8226310ab35a61703cba6b8bbbffe8281 | [
"MIT"
] | null | null | null | 2016/day06.py | XtinaSchelin/adventofcode | 41aa36c8226310ab35a61703cba6b8bbbffe8281 | [
"MIT"
] | null | null | null | example = """eedadn
drvtee
eandsr
raavrd
atevrs
tsrnev
sdttsa
rasrtv
nssdts
ntnada
svetve
tesnvt
vntsnd
vrdear
dvrsen
enarar"""
answer = {
"a": "easter",
"b": "advent"
}
do_day(test=False, day="a")
do_day(test=False, day="b")
| 16.404255 | 57 | 0.634241 | example = """eedadn
drvtee
eandsr
raavrd
atevrs
tsrnev
sdttsa
rasrtv
nssdts
ntnada
svetve
tesnvt
vntsnd
vrdear
dvrsen
enarar"""
answer = {
"a": "easter",
"b": "advent"
}
def do_day(test=False, day="a"):
if test:
inputs = example.split("\n")
else:
inputs = open("d6.txt", "r").read().split("\n")
width = len(in... | 518 | 0 | 23 |
b87b9d7e222109a95d5d07a30c8292dd7c469831 | 619,205 | py | Python | pysnmp/INFORMANT-HW.py | agustinhenze/mibs.snmplabs.com | 1fc5c07860542b89212f4c8ab807057d9a9206c7 | [
"Apache-2.0"
] | 11 | 2021-02-02T16:27:16.000Z | 2021-08-31T06:22:49.000Z | pysnmp/INFORMANT-HW.py | agustinhenze/mibs.snmplabs.com | 1fc5c07860542b89212f4c8ab807057d9a9206c7 | [
"Apache-2.0"
] | 75 | 2021-02-24T17:30:31.000Z | 2021-12-08T00:01:18.000Z | pysnmp/INFORMANT-HW.py | agustinhenze/mibs.snmplabs.com | 1fc5c07860542b89212f4c8ab807057d9a9206c7 | [
"Apache-2.0"
] | 10 | 2019-04-30T05:51:36.000Z | 2022-02-16T03:33:41.000Z | #
# PySNMP MIB module INFORMANT-HW (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/INFORMANT-HW
# Produced by pysmi-0.3.4 at Mon Apr 29 19:42:12 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019,... | 147.429762 | 10,010 | 0.736344 | #
# PySNMP MIB module INFORMANT-HW (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/INFORMANT-HW
# Produced by pysmi-0.3.4 at Mon Apr 29 19:42:12 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019,... | 0 | 0 | 0 |
7f4663c3ca07092e3d88372ce08c7494eb32b7a6 | 3,058 | py | Python | geometry_utils/polygons.py | NOAA-ORR-ERD/geometry_utils | 0417a8c459fb17f101945f53d048191dc22e97c0 | [
"BSD-3-Clause"
] | null | null | null | geometry_utils/polygons.py | NOAA-ORR-ERD/geometry_utils | 0417a8c459fb17f101945f53d048191dc22e97c0 | [
"BSD-3-Clause"
] | null | null | null | geometry_utils/polygons.py | NOAA-ORR-ERD/geometry_utils | 0417a8c459fb17f101945f53d048191dc22e97c0 | [
"BSD-3-Clause"
] | null | null | null | #!/usr/bin/env python
"""
Single module to hold the high-level API
"""
import numpy as np
from .cy_point_in_polygon import points_in_poly, points_in_polys, signed_area
def polygon_inside(polygon_verts, trial_points):
'''
Return a Boolean array the size of the trial point array True if point is inside
... | 24.66129 | 87 | 0.637672 | #!/usr/bin/env python
"""
Single module to hold the high-level API
"""
import numpy as np
from .cy_point_in_polygon import points_in_poly, points_in_polys, signed_area
def polygon_inside(polygon_verts, trial_points):
'''
Return a Boolean array the size of the trial point array True if point is inside
... | 0 | 0 | 0 |
d851892ba47a6c83cd440bb200126b2b7ce165a7 | 59 | py | Python | tests/roots/test-latex-equations/conf.py | samdoran/sphinx | 4c91c038b220d07bbdfe0c1680af42fe897f342c | [
"BSD-2-Clause"
] | 4,973 | 2015-01-03T15:44:00.000Z | 2022-03-31T03:11:51.000Z | tests/roots/test-latex-equations/conf.py | samdoran/sphinx | 4c91c038b220d07bbdfe0c1680af42fe897f342c | [
"BSD-2-Clause"
] | 7,850 | 2015-01-02T08:09:25.000Z | 2022-03-31T18:57:40.000Z | tests/roots/test-latex-equations/conf.py | samdoran/sphinx | 4c91c038b220d07bbdfe0c1680af42fe897f342c | [
"BSD-2-Clause"
] | 2,179 | 2015-01-03T15:26:53.000Z | 2022-03-31T12:22:44.000Z | root_doc = 'equations'
extensions = ['sphinx.ext.imgmath']
| 19.666667 | 35 | 0.728814 | root_doc = 'equations'
extensions = ['sphinx.ext.imgmath']
| 0 | 0 | 0 |
e1ed0943c01f3e869578d25a54fde319e2b5f1c2 | 414 | py | Python | idb/ipc/set_location.py | sergey-plevako-badoo/FBSimulatorControl | 117af8508ba7405bdbacd29ec95a0523b3926ad3 | [
"MIT"
] | 1 | 2019-06-12T16:46:25.000Z | 2019-06-12T16:46:25.000Z | idb/ipc/set_location.py | BalestraPatrick/idb | 9deac2af129e7595c303c121944034c556202454 | [
"MIT"
] | null | null | null | idb/ipc/set_location.py | BalestraPatrick/idb | 9deac2af129e7595c303c121944034c556202454 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
from idb.grpc.types import CompanionClient
from idb.grpc.idb_pb2 import Location, SetLocationRequest
| 31.846154 | 85 | 0.768116 | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
from idb.grpc.types import CompanionClient
from idb.grpc.idb_pb2 import Location, SetLocationRequest
async def client(client: CompanionClient, latitude: float, longitude: float) -> None:
await client.stub.set_location... | 192 | 0 | 23 |
f088ad78a27a68201c4659c90d3a22c20eeace18 | 3,904 | py | Python | libvips-8.11/test/test-suite/test_connection.py | MFerrol/Create_Web | 76c8590ffffc6834a13f8efaf5ca7a5829cb1c32 | [
"MIT"
] | 2 | 2020-11-19T04:09:33.000Z | 2020-11-24T04:51:19.000Z | libvips-8.11/test/test-suite/test_connection.py | MFerrol/Create_Web | 76c8590ffffc6834a13f8efaf5ca7a5829cb1c32 | [
"MIT"
] | null | null | null | libvips-8.11/test/test-suite/test_connection.py | MFerrol/Create_Web | 76c8590ffffc6834a13f8efaf5ca7a5829cb1c32 | [
"MIT"
] | 1 | 2021-01-16T10:36:37.000Z | 2021-01-16T10:36:37.000Z | # vim: set fileencoding=utf-8 :
import sys
import os
import shutil
import tempfile
import pytest
import pyvips
from helpers import \
JPEG_FILE, PNG_FILE, TIF_FILE, \
temp_filename, assert_almost_equal_objects, have, skip_if_no
if __name__ == '__main__':
pytest.main()
| 30.263566 | 78 | 0.645236 | # vim: set fileencoding=utf-8 :
import sys
import os
import shutil
import tempfile
import pytest
import pyvips
from helpers import \
JPEG_FILE, PNG_FILE, TIF_FILE, \
temp_filename, assert_almost_equal_objects, have, skip_if_no
class TestConnection:
tempdir = None
@classmethod
def setup_class(cl... | 2,843 | 754 | 23 |
9035c950a611c8178e20aa0443d1ac85be9f85f1 | 975 | py | Python | tests/test_predict.py | yubin-park/bonsai-dt | 2a51c766135aca7d8b2d8411b174c417d5257a10 | [
"Apache-2.0"
] | 32 | 2018-07-20T17:20:58.000Z | 2021-12-18T02:32:34.000Z | tests/test_predict.py | yubin-park/bonsai-dt | 2a51c766135aca7d8b2d8411b174c417d5257a10 | [
"Apache-2.0"
] | 4 | 2018-08-05T02:08:31.000Z | 2021-12-29T13:49:59.000Z | tests/test_predict.py | yubin-park/bonsai-dt | 2a51c766135aca7d8b2d8411b174c417d5257a10 | [
"Apache-2.0"
] | 6 | 2018-10-15T16:17:08.000Z | 2022-03-11T13:40:00.000Z | from bonsai.base.regtree import RegTree
from sklearn.datasets import make_friedman1
from sklearn.model_selection import train_test_split
import numpy as np
import unittest
from misc import apply_tree
if __name__=="__main__":
unittest.main()
| 27.083333 | 68 | 0.652308 | from bonsai.base.regtree import RegTree
from sklearn.datasets import make_friedman1
from sklearn.model_selection import train_test_split
import numpy as np
import unittest
from misc import apply_tree
class PredictTestCase(unittest.TestCase):
def test_predict(self):
n_samples = 1000
max_depth = 4
... | 656 | 20 | 50 |
1695e1a487c6dc41e43b37a202b43542fb71c194 | 607 | py | Python | Chapter08/Numba/mat_mul_numba.py | ibiscum/Python-Parallel-Programming-Cookbook-Second-Edition | 8fd583019778b4d797d4f948d091b5564e23f732 | [
"MIT"
] | null | null | null | Chapter08/Numba/mat_mul_numba.py | ibiscum/Python-Parallel-Programming-Cookbook-Second-Edition | 8fd583019778b4d797d4f948d091b5564e23f732 | [
"MIT"
] | null | null | null | Chapter08/Numba/mat_mul_numba.py | ibiscum/Python-Parallel-Programming-Cookbook-Second-Edition | 8fd583019778b4d797d4f948d091b5564e23f732 | [
"MIT"
] | null | null | null | from numba import guvectorize
import numpy as np
@guvectorize(['void(int64[:,:], int64[:,:], int64[:,:])'],
'(m,n),(n,p)->(m,p)')
dim = 10
A = np.random.randint(dim, size=(dim, dim))
B = np.random.randint(dim, size=(dim, dim))
C = matmul(A, B)
print("INPUT MATRIX A")
print(":\n%s" % A)
print("INPUT MA... | 21.678571 | 58 | 0.500824 | from numba import guvectorize
import numpy as np
@guvectorize(['void(int64[:,:], int64[:,:], int64[:,:])'],
'(m,n),(n,p)->(m,p)')
def matmul(A, B, C):
m, n = A.shape
n, p = B.shape
for i in range(m):
for j in range(p):
C[i, j] = 0
for k in range(n):
... | 187 | 0 | 22 |
e427ea78ee0e6ff1afd4d96cff4f165ff41942e5 | 3,298 | py | Python | src/utils/custom_models/helpers.py | MadryLab/smoothed-vit | a4327542e519e010764821716b64b944d458d1c1 | [
"MIT"
] | 16 | 2021-10-14T18:39:46.000Z | 2022-03-30T13:47:07.000Z | src/utils/custom_models/helpers.py | anonymousneurips21/paper4705 | 3a984c20d02f6317dceec49468f99303d3af265b | [
"MIT"
] | 1 | 2021-12-01T01:05:36.000Z | 2021-12-01T05:31:44.000Z | src/utils/custom_models/helpers.py | anonymousneurips21/paper4705 | 3a984c20d02f6317dceec49468f99303d3af265b | [
"MIT"
] | 1 | 2022-02-04T18:16:46.000Z | 2022-02-04T18:16:46.000Z | import logging
import math
import torch.utils.model_zoo as model_zoo
_logger = logging.getLogger(__name__)
| 45.805556 | 108 | 0.651607 | import logging
import math
import torch.utils.model_zoo as model_zoo
_logger = logging.getLogger(__name__)
def load_pretrained(model, cfg=None, num_classes=1000, in_chans=3, filter_fn=None, strict=True):
if cfg is None:
cfg = getattr(model, 'default_cfg')
if cfg is None or 'url' not in cfg or not cf... | 3,165 | 0 | 23 |
5bdefb3dc05db12194db8100ce9aecc60b323e25 | 3,840 | py | Python | behavioral/observer/observer.py | kimgea/design_patterns | def656f50c4f26e25f8a0d2920041c2f002dc2d0 | [
"MIT"
] | null | null | null | behavioral/observer/observer.py | kimgea/design_patterns | def656f50c4f26e25f8a0d2920041c2f002dc2d0 | [
"MIT"
] | null | null | null | behavioral/observer/observer.py | kimgea/design_patterns | def656f50c4f26e25f8a0d2920041c2f002dc2d0 | [
"MIT"
] | null | null | null |
from collections import defaultdict
#TODO: rename obj to something more descriptive
#TODO: make test cases to test everything
#######################################################################################################
| 29.090909 | 137 | 0.567969 |
from collections import defaultdict
#TODO: rename obj to something more descriptive
#TODO: make test cases to test everything
class Observable:
def __init__(self, observers=defaultdict(set), shared=False):
if not observers and not shared:
self._observers = defaultdict(set)
else:
... | 595 | 2,832 | 170 |
161df7fb40f3e0fac4552514bffeab3707054a69 | 701 | py | Python | Modules/Logging/reactions.py | DevFlock/Discord-Bot | 912430f82daa5d906f558b4c3394af07b95f7705 | [
"Apache-2.0"
] | null | null | null | Modules/Logging/reactions.py | DevFlock/Discord-Bot | 912430f82daa5d906f558b4c3394af07b95f7705 | [
"Apache-2.0"
] | null | null | null | Modules/Logging/reactions.py | DevFlock/Discord-Bot | 912430f82daa5d906f558b4c3394af07b95f7705 | [
"Apache-2.0"
] | null | null | null | import discord
from discord.ext import commands
from console import Console
console = Console(True) | 30.478261 | 113 | 0.687589 | import discord
from discord.ext import commands
from console import Console
console = Console(True)
class reaction_add(commands.Cog):
def __init__(self, client):
self.client = client
@commands.Cog.listener()
async def on_reaction_add(self, reaction, user):
if not user.bot:
co... | 404 | 151 | 46 |
2cbd092b94ee6e22413412264d56314d23017962 | 2,869 | py | Python | src/model/purchase_order.py | mjovanc/trademax-api-client | ac71e9b457b087c7b3d6fcdfea27a989ca7ec875 | [
"MIT"
] | null | null | null | src/model/purchase_order.py | mjovanc/trademax-api-client | ac71e9b457b087c7b3d6fcdfea27a989ca7ec875 | [
"MIT"
] | 7 | 2020-12-28T11:56:49.000Z | 2021-01-07T17:37:16.000Z | src/model/purchase_order.py | mjovanc/trademax-api-client | ac71e9b457b087c7b3d6fcdfea27a989ca7ec875 | [
"MIT"
] | null | null | null | class PurchaseOrder:
"""
Represents a Purchase Order.
"""
id = ''
purchase_order_id = ''
latest = False
created_at = ''
acknowledged_at = ''
requested_delivery_from = ''
requested_delivery_to = ''
currency = ''
gross_amount = 0.0
tax_amount = 0.0
total_amount = 0.... | 34.566265 | 88 | 0.629488 | class PurchaseOrder:
"""
Represents a Purchase Order.
"""
id = ''
purchase_order_id = ''
latest = False
created_at = ''
acknowledged_at = ''
requested_delivery_from = ''
requested_delivery_to = ''
currency = ''
gross_amount = 0.0
tax_amount = 0.0
total_amount = 0.... | 938 | 0 | 27 |
88c499fae475f8ce4183b9360bb5d02b4b41efc5 | 198 | py | Python | Codewars_Python/evens_and_odds.py | nlantau/Codewars_2020_2021 | 055fbf8785ddd52b9f8e8c2b59294ead01852467 | [
"MIT"
] | null | null | null | Codewars_Python/evens_and_odds.py | nlantau/Codewars_2020_2021 | 055fbf8785ddd52b9f8e8c2b59294ead01852467 | [
"MIT"
] | null | null | null | Codewars_Python/evens_and_odds.py | nlantau/Codewars_2020_2021 | 055fbf8785ddd52b9f8e8c2b59294ead01852467 | [
"MIT"
] | null | null | null | # nlantau, 2020-11-09
print(evens_and_odds(1))
print(evens_and_odds(2))
print(evens_and_odds(3))
print(evens_and_odds(13))
| 16.5 | 47 | 0.681818 | # nlantau, 2020-11-09
def evens_and_odds(n):
return f"{n:b}" if n % 2 == 0 else f"{n:x}"
print(evens_and_odds(1))
print(evens_and_odds(2))
print(evens_and_odds(3))
print(evens_and_odds(13))
| 49 | 0 | 23 |
46c4bbfd794514a9483cd31567afb5a49fb90916 | 692 | py | Python | tests/conftest.py | nickdelgrosso/bg-atlasapi | 0cee4ad299ebe77b5a23af904376bbd7392a843b | [
"BSD-3-Clause"
] | 43 | 2020-07-27T23:40:06.000Z | 2022-02-01T14:24:30.000Z | tests/conftest.py | nickdelgrosso/bg-atlasapi | 0cee4ad299ebe77b5a23af904376bbd7392a843b | [
"BSD-3-Clause"
] | 66 | 2020-07-01T09:13:57.000Z | 2022-03-31T17:17:22.000Z | tests/conftest.py | nickdelgrosso/bg-atlasapi | 0cee4ad299ebe77b5a23af904376bbd7392a843b | [
"BSD-3-Clause"
] | 7 | 2020-09-03T17:43:27.000Z | 2022-02-10T12:29:23.000Z | import pytest
from bg_atlasapi.bg_atlas import BrainGlobeAtlas
import tempfile
import shutil
from pathlib import Path
@pytest.fixture()
@pytest.fixture()
@pytest.fixture(scope="module")
| 21.625 | 77 | 0.738439 | import pytest
from bg_atlasapi.bg_atlas import BrainGlobeAtlas
import tempfile
import shutil
from pathlib import Path
@pytest.fixture()
def atlas():
return BrainGlobeAtlas("example_mouse_100um")
@pytest.fixture()
def temp_path():
path = Path(tempfile.mkdtemp())
yield path
shutil.rmtree(path)
@pyte... | 386 | 0 | 112 |
65ba6a8ca1f55c46bf837b2041f28e7bb884ba9e | 10,007 | py | Python | models.py | killamocingbird/viralmodel | 38f0a64af9082f53c02117697e41ded896b58684 | [
"MIT"
] | null | null | null | models.py | killamocingbird/viralmodel | 38f0a64af9082f53c02117697e41ded896b58684 | [
"MIT"
] | null | null | null | models.py | killamocingbird/viralmodel | 38f0a64af9082f53c02117697e41ded896b58684 | [
"MIT"
] | null | null | null | import distributions
import math
import numpy as np
import os
import projections
import random
import sys
# Interface for models
# ToImplement
# Dumps the data into a file
class Base(Model_Backbone):
"""
In this model, each forward step represe... | 41.18107 | 133 | 0.503847 | import distributions
import math
import numpy as np
import os
import projections
import random
import sys
# Interface for models
class Model_Backbone:
def __init__(self, cfg, pfs):
self.cfg = cfg
self.pfs = pfs
self.data = dict()
# ToImplement
def forward(self):
... | 8,583 | 0 | 469 |