id stringlengths 1 7 | text stringlengths 6 1.03M | dataset_id stringclasses 1
value |
|---|---|---|
23254 | # -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making BK-BASE 蓝鲸基础平台 available.
Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
BK-BASE 蓝鲸基础平台 is licensed under the MIT License.
License for BK-BASE 蓝鲸基础平台:
------------------------------------------... | StarcoderdataPython |
3348455 | from nose.tools import eq_, ok_
from django.core.urlresolvers import resolve, reverse
def assert_routing(url, view_function_or_class, name = '', kwargs = {}):
resolved_route = resolve(url)
ok_((resolved_route.func is view_function_or_class) or (type(resolved_route.func) is view_function_or_class))
if kwarg... | StarcoderdataPython |
1679726 | import uharfbuzz as hb
import re
from pathlib import Path
from fontTools.ttLib import TTFont
from beziers.path import BezierPath
from beziers.path.geometricshapes import Rectangle
from beziers.utils.linesweep import bbox_intersections
from beziers.point import Point
from beziers.boundingbox import BoundingBox
from glyp... | StarcoderdataPython |
155452 | <gh_stars>0
import uuid
def genaratorActiveCode(number=200):
result = []
while True is True:
uuid_id=uuid.uuid1()
tem=str(uuid_id).replace('-','')
tmmm=str(tem[4:])
if not tmmm in result:
result.append(tmmm)
if len(result) is number:
break
print result
if __name__=='__main__':
genaratorActiveCode... | StarcoderdataPython |
3271696 | <gh_stars>0
x = 5
print (x, "tipenya adalah ", type(x))
x = 2.0
print (x, "tipenya adalah ", type(x))
| StarcoderdataPython |
165167 | import imp
import sys
def new_module(name):
"""
Do all of the gruntwork associated with creating a new module.
"""
parent = None
if '.' in name:
parent_name = name.rsplit('.', 1)[0]
parent = __import__(parent_name, fromlist=[''])
module = imp.new_module(name)
sys.modules[... | StarcoderdataPython |
1672911 | <reponame>leytes/scona
#!/usr/bin/env python
import pandas as pd
import numpy as np
import os
def read_in_data(
data,
names_file,
covars_file=None,
centroids_file=None,
data_as_df=True):
'''
Read in data from file paths
Parameters
----------
data : str
... | StarcoderdataPython |
1695280 | from flask import Flask
from app.routes.routes import blueprint
from app.auth.auth import auth_blueprint
from app.fine_tune.fine_tune import fine_tune_blueprint
from app.select_tracks.select_tracks import select_blueprint
from app.result.result import result_blueprint
from app.home.home import home_blueprint
from app.... | StarcoderdataPython |
1749873 | from seahub.views.repo import get_upload_url
from seahub.test_utils import BaseTestCase
class GetUploadUrlTest(BaseTestCase):
def test_can_get(self):
rst = get_upload_url(self.fake_request, self.repo.id)
assert '8082' in rst
| StarcoderdataPython |
3236248 | <reponame>davan690/talks.ox<filename>talks/events/urls.py<gh_stars>0
from django.conf.urls import patterns, url
from talks.events.views import (upcoming_events, show_person, show_event, events_for_day, show_department_organiser,
events_for_month, events_for_year, list_event_groups,show_... | StarcoderdataPython |
3323479 | <reponame>mommermi/cloudynight
""" Licensed under a 3-clause BSD style license - see LICENSE.rst
This script shows how to extract features from raw images.
The use of this script requires a mask file,
which has to be created with the script generate_mask.py
(c) 2020, <NAME> (<EMAIL>)
"""
import os
import requests
imp... | StarcoderdataPython |
1702518 | <reponame>spotlightpa/covid-alerts-emailer<gh_stars>1-10
from src.definitions import (
DIR_TEMPLATES,
DIR_TESTS_OUTPUT,
)
from src.modules.gen_html.gen_html import gen_html
from src.modules.gen_html.gen_jinja_vars import gen_jinja_vars
def test_gen_html_dauphin(dauphin_info, dauphin_payload, stories_clean):
... | StarcoderdataPython |
106775 | import requests
r = "\033[1;31m"
g = "\033[1;32m"
y = "\033[1;33m"
b = "\033[1;34m"
x = "\033[0;0m"
banner="""
_______________________________________
| .__ .___ .__ |
| ______ |__| __| _/_____ |__| ____ |
| \____ \| |/ __ |/ \| |/ \ |
| | |_> > / /_/ | Y Y \ | | \ |
| | _... | StarcoderdataPython |
1649863 | <gh_stars>1-10
import requests
import time
import os
import sqlite3
def init_make_request():
global conn
global last_hour
global last_minute
global queries_for_last_minute
global queries_for_last_hour
last_hour = time.clock()
last_minute = time.clock()
queries_for_last_minute = 0
... | StarcoderdataPython |
1756505 | from setuptools import setup, find_packages
import os
from datarobot_drum.drum.description import version, project_name
from datarobot_drum.drum.common import extra_deps, SupportedFrameworks
# The directory containing this file
root = os.path.dirname(os.path.abspath(__file__))
with open(os.path.join(root, "requireme... | StarcoderdataPython |
1655660 | <filename>fplib/misc.py<gh_stars>0
from fplib.curry import curry
def fail(x):
raise ValueError(x)
def ident(x):
return x
@curry
def compose(f, g, x):
return f(g(x))
@curry
def const(x, y):
return x
| StarcoderdataPython |
1783839 | import unittest
from unittest import TestCase
from algorithms.dataStructures.LinkedList import Node
from algorithms.dataStructures.LinkedList import LinkedList
class linked_list_Test(TestCase):
def test_create_node(self):
n = Node(1)
self.assertIsInstance(n, Node)
def test_create_node_assig... | StarcoderdataPython |
1796362 | <filename>bin/pointGravityInversion.py
#!/usr/bin/python3
__copyright__ = "Copyright (c) 2021 by University of Queensland http://www.uq.edu.au"
__license__ = "Licensed under the Apache License, version 2.0 http://www.apache.org/licenses/LICENSE-2.0"
__credits__ = "<NAME>"
import importlib, sys, os
sys.path.insert(... | StarcoderdataPython |
1729506 | from dataclasses import dataclass
import dataclass_factory
from dataclass_factory import Schema
@dataclass
class Book:
title: str
price: int
extra: str = ""
data = {
"title": "Fahrenheit 451",
"price": 100,
"extra": "some extra string"
}
# using `only`:
factory = dataclass_factory.Factory(... | StarcoderdataPython |
17363 | from collections import OrderedDict
from unittest import TestCase
from frozenordereddict import FrozenOrderedDict
class TestFrozenOrderedDict(TestCase):
ITEMS_1 = (
("b", 2),
("a", 1),
)
ITEMS_2 = (
("d", 4),
("c", 3),
)
ODICT_1 = OrderedDict(ITEMS_1)
ODICT_2 ... | StarcoderdataPython |
134197 | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | StarcoderdataPython |
1691002 | """
Solution class
problemId 128
@author wanghaogang
@date 2018/6/29
"""
class Solution:
def longestConsecutive(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
length = len(nums)
if not nums or length == 0:
return 0
s = set(nums)
... | StarcoderdataPython |
1704375 | from django.conf.urls import url
from django.contrib import admin
from revenue.views import (
revenue_list,
revenue_detail,
)
urlpatterns = [
#url(r'^admin/', admin.site.urls),
url(r'^$', revenue_list, name="list"),
url(r'^(?P<id>[\w-]+)/$', revenue_detail, name="detail"),
] | StarcoderdataPython |
3389154 | <gh_stars>1-10
from cyder.cydns.domain.tests.all import *
from cyder.cydns.soa.tests.all import *
from cyder.cydns.tests.test_models import *
from cyder.cydns.tests.test_views import *
| StarcoderdataPython |
1622414 | <gh_stars>0
"""Load data from database for training the wordchooser."""
import os
import re
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
import torchtext
import nltk
#raise RuntimeError("Not ready yet")
class WordChooserDataset(torch.utils.data.IterableDataset):
... | StarcoderdataPython |
3354424 | # Copyright The PyTorch Lightning 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/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... | StarcoderdataPython |
3340691 | from datetime import datetime
def get_current_month():
now = datetime.now()
return now.month
def get_current_year():
now = datetime.now()
return now.year
| StarcoderdataPython |
1605212 | <gh_stars>1-10
import os
from fase_lib import fase
from fase_lib import fase_config
from fase_lib import fase_application
import config as notes_config
import service as notes_service
fase.Service.RegisterService(notes_service.NotesService)
notes_config.Configurate(os.environ['NOTES_CONFIG_FILENAME'])
fase_config... | StarcoderdataPython |
1768504 | #!/usr/bin/env python3
# Copyright 2010-2021 Google LLC
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... | StarcoderdataPython |
1655602 | #
import torch
import os
import numpy
import cv2
#
def generate_triplets(bags):
#
triplets = []
for i in range(0, len(bags)):
for j in range(i+1, len(bags)):
if bags[i][1] == bags[j][1]: # compare labels
#
negbags = []
#
for k in range(0, 6):
#
stop = False
while not stop:
... | StarcoderdataPython |
3338903 | urls = [
"pagecounts-20121001-000000.gz",
"pagecounts-20121001-010000.gz",
"pagecounts-20121001-020000.gz",
"pagecounts-20121001-030000.gz",
"pagecounts-20121001-040000.gz",
"pagecounts-20121001-050000.gz",
"pagecounts-20121001-060001.gz",
"pagecounts-20121001-070000.gz",
"pagecounts-20121001-080000.gz",
"pagecounts-20... | StarcoderdataPython |
4836988 | from openerp.osv import fields, osv
class stock_move(osv.Model):
_name = 'stock.move'
_inherit = 'stock.move'
def onchange_product_id(self, cr, uid, ids, prod_id=False, loc_id=False,
loc_dest_id=False, partner_id=False):
res_prod = super(stock_move, self).onchange_produ... | StarcoderdataPython |
3201109 | <filename>scrapper/web_scrapper.py
from bs4 import BeautifulSoup
import requests
import re
from math import ceil
all_quotes= {}
global_countr= 1
def clean_quote(quote_uncleaned):
# remove unwanted characters
cleaned_quote1= re.sub('\n','',quote_uncleaned)
cleaned_quote2= re.sub(' +',' ',cleaned_quote1)
... | StarcoderdataPython |
3367343 | <filename>Numbers/change.py<gh_stars>10-100
#!/usr/bin/env python3
# Change Calculator
# Calculates the change for US dollar
# Prints out the type of bills and coins
# that needs to be given to the customer
def changeCoins(change):
p = 0 # 0.01
n = 0 # 0.05
d = 0 # 0.10
q = 0 # 0.25
changeC... | StarcoderdataPython |
45966 | from satsolver import SatSolver
from dimacs import Glucose, RSat
try:
from cryptominisat import CryptoMiniSat
except ImportError:
pass
| StarcoderdataPython |
3331740 | # app/robo_advisor.py
import requests
import dotenv
import json
import datetime
import csv
import os
from dotenv import load_dotenv
import plotly.graph_objects as go
import operator
# LOAD .ENV ----------------------------------------------------------------------
load_dotenv()
api_key = os.environ.get('ALPHAVANTA... | StarcoderdataPython |
170290 | # Generated by Django 3.0.3 on 2020-03-18 19:02
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('staff', '0010_auto_20200318_1846'),
]
operations = [
migrations.RenameField(
model_name='instructor',
old_name='text_history... | StarcoderdataPython |
3394529 | <reponame>tektecher/micropython
# Dev by <NAME>
from machine import Pin, ADC
adc = ADC(Pin(36))
adc.atten(ADC.ATTN_11DB)
adc.width(ADC.WIDTH_12BIT)
def read():
return adc.read()
| StarcoderdataPython |
4823285 | <reponame>liuyangdh/multimodal-vae-public
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
import os
import random
import numpy as np
from copy import deepcopy
from PIL import Image
import torch
from torch.utils.data.dataset import Dataset
from torchvision i... | StarcoderdataPython |
3285748 | <gh_stars>1-10
from asyncio import Future, ensure_future, get_running_loop # no
from functools import partial
from typing import Awaitable
from ..command import Command
from ..constants import SessionState
from ..message import Message
from ..notification import Notification
from ..security import Authentication
from ... | StarcoderdataPython |
110493 | #%%
from datetime import datetime
import numpy as np
import pandas as pd
from tqdm import tqdm
# %%
picks = pd.read_csv('gamma_picks.csv', sep="\t")
events = pd.read_csv('gamma_catalog.csv', sep="\t")
# %%
events["match_id"] = events.apply(lambda x: f'{x["event_idx"]}_{x["file_index"]}', axis=1)
picks["match_id"] = ... | StarcoderdataPython |
7155 | <reponame>jeffkimbrel/MergeMetabolicAnnotations<filename>lib/MergeMetabolicAnnotations/utils/CompareAnnotationsUtil.py<gh_stars>1-10
import os
import datetime
import logging
import json
import uuid
from installed_clients.WorkspaceClient import Workspace as Workspace
from installed_clients.KBaseReportClient import KBas... | StarcoderdataPython |
47096 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.11 on 2019-01-25 09:24
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('focus', '0003_auto_20190125_1721'),
]
operations = [
migrations.AlterModelOptions(... | StarcoderdataPython |
3318634 | <filename>miners/__init__.py
from miners.Miner import Miner
from miners.imdb.ImdbMiner import IMDB
| StarcoderdataPython |
50425 | import cv2
import numpy as np
from shapes import Myinit
class Triangle(Myinit):
def __init__(self):
super(Triangle, self).__init__()
self.vertices = np.array([[100,50], [150,150], [50,150]],np.int32)
self.vertices = self.vertices.reshape((-1, 1, 2))
self.color=(255,0,255)
... | StarcoderdataPython |
1632347 | #!/usr/bin/env python
import rospy
import math
import cv2
from cv_bridge import CvBridge
from sensor_msgs.msg import Image
import numpy as np
from geometry_msgs.msg import Twist, Pose
from move_base_msgs.msg import MoveBaseActionGoal
from sensor_msgs.msg import LaserScan
from nav_msgs.msg import Odometry
class Debri... | StarcoderdataPython |
3287330 | <reponame>y-agg/pywakit
from termcolor import colored
from urllib.request import urlopen
from selenium import webdriver
from selenium.webdriver.common.by import By
from time import sleep
from datetime import datetime
from win32com.client import Dispatch
from win32com.client import Dispatch
import platform, requests, zi... | StarcoderdataPython |
1790326 | from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from flask_migrate import Migrate
from decouple import config
app = Flask(__name__)
app.config.from_object(config("APP_SETTINGS"))
db = SQLAlchemy(app)
migrate = Migrate(app, db)
from core import routes | StarcoderdataPython |
43616 | <filename>cluster_scripts/gen_train_exp.py
#!/usr/bin/env python3
"""Script for generating experiments.txt"""
import os
from lxml import etree
from dotenv import load_dotenv, find_dotenv
import sys
from pathlib import Path
sys.path.append(str(Path(__file__).parent.parent))
from config import ANALYSIS as cfg
load_doten... | StarcoderdataPython |
13885 | cars = 100
space_in_a_car = 4.0
drivers = 30
passengers = 90
cars_not_driven = cars -drivers
cars_driven = drivers
carpool_carpacity = cars_driven * space_in_a_car
average_passengers_per_car = passengers / cars_driven
print("There are", cars, "cars available")
print("There are only", drivers, "drivers available")
prin... | StarcoderdataPython |
4811220 | /home/runner/.cache/pip/pool/d0/ae/4d/24abaf2af3445a9f845fb8f43838b765042020c1e86f348526adc6ef23 | StarcoderdataPython |
21726 | <reponame>gitter-badger/DHOD
import numpy as np
import sys, os
from scipy.optimize import minimize
import json
import matplotlib.pyplot as plt
#
sys.path.append('./utils')
import tools
#
bs, ncf, stepf = 400, 512, 40
path = '../data/z00/'
ftype = 'L%04d_N%04d_S%04d_%02dstep/'
ftypefpm = 'L%04d_N%04d_S%04d_%02dstep_f... | StarcoderdataPython |
117853 | <reponame>sfox14/butterfly
import numpy as np
import torch
from torch.nn import functional as F
from numpy.polynomial import chebyshev, legendre
from utils import bitreversal_permutation
def polymatmul(A, B):
"""Batch-multiply two matrices of polynomials
Parameters:
A: (N, batch_size, n, m, d1)
... | StarcoderdataPython |
1604991 | # Problem Link : Check Sheet link below
# Excel-Sheet Link : https://drive.google.com/file/d/1L3EOLDMs-Fx2XoKclkCg1OVymDGh6psP/view?usp=sharing
# Youtube Video Link :
# Q> Find Union and Intersections of 2 Arrays
# Fundamental / Naive Approach
def Solution_1(Array_1, Array_2): # Time: O(m*n), Space: O(0)
Union ... | StarcoderdataPython |
1729301 | from django.contrib import admin
from .models import Thing, Country, Continent, AdministrativeArea, Landform, Place, Text
# Register your models here.
admin.site.register(Thing)
admin.site.register(Country)
admin.site.register(Continent)
admin.site.register(AdministrativeArea)
admin.site.register(Landform)
admin.sit... | StarcoderdataPython |
3219955 | <gh_stars>0
"""
Constants and other config variables used throughout the packagemanager module
Copyright (C) 2017-2022 Intel Corporation
SPDX-License-Identifier: Apache-2.0
"""
# Configuration command/response channel
CONFIGURATION_CMD_CHANNEL = 'configuration/command/'
CONFIGURATION_RESP_CHANNEL = 'confi... | StarcoderdataPython |
120125 | <gh_stars>1-10
# AUTOGENERATED! DO NOT EDIT! File to edit: 00_core.ipynb (unless otherwise specified).
__all__ = ['Config', 'URLs', 'download_data', 'file_extract', 'download_file_from_google_drive', 'untar_data']
# Cell
import os
import shutil
import requests
from pathlib import Path
from tqdm.notebook import tqdm
i... | StarcoderdataPython |
27796 | # -*- coding: UTF-8 -*-
import numpy as np
from numpy.testing import assert_array_almost_equal
from spectral_clustering.spectral_embedding_ import spectral_embedding
def assert_first_col_equal(maps):
constant_vec = [1] * maps.shape[0]
assert_array_almost_equal(maps[:, 0] / maps[0, 0], constant_vec)
def test... | StarcoderdataPython |
1603026 | import unittest2 as unittest
import pymongo
import time
import random
import threading
from oplogreplay import OplogReplayer
SOURCE_HOST = '127.0.0.1:27017'
DEST_HOST = '127.0.0.1:27018'
TESTDB = 'testdb'
# Inherit from OplogReplayer to count number of processed_op methodcalls.
class CountingOplogReplayer(OplogRepl... | StarcoderdataPython |
3234570 | <filename>tests/performance_lighthouse.py
#-*- coding: utf-8 -*-
import sys
import socket
import ssl
import json
import requests
import urllib # https://docs.python.org/3/library/urllib.parse.html
import uuid
import re
from bs4 import BeautifulSoup
import config
from tests.utils import *
import gettext
_ = gettext.gett... | StarcoderdataPython |
1670964 | from __future__ import absolute_import
from functools import wraps
import types
from django.views.decorators.http import require_GET
from django.views.generic import View
from .response import get_jsonp_response
from .utils import get_callback
def jsonp(view):
if isinstance(view, types.FunctionType):
@... | StarcoderdataPython |
1797811 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Box Least Squares
=================
AstroPy-compatible reference implementation of the transit periorogram used
to discover transiting exoplanets.
"""
__all__ = ["BoxLeastSquares", "BoxLeastSquaresResults"]
from .core import BoxLeastSquares, BoxLe... | StarcoderdataPython |
54720 | <filename>direct/fsm/StatePush.py
# uncompyle6 version 3.2.4
# Python bytecode 2.7 (62211)
# Decompiled from: Python 2.7.15 (v2.7.15:ca079a3ea3, Apr 30 2018, 16:30:26) [MSC v.1500 64 bit (AMD64)]
# Embedded file name: direct.fsm.StatePush
__all__ = [
'StateVar', 'FunctionCall', 'EnterExit', 'Pulse', 'EventPulse',
'Ev... | StarcoderdataPython |
150172 | <reponame>edith007/The-Movie-Database
from django.shortcuts import render, redirect
import urllib.request
from random import shuffle
from .models import Show, UserRating
from django.contrib.auth.models import User
from django.core.paginator import Paginator
def home(request):
shows = list(Show.objects.all())
... | StarcoderdataPython |
167909 | <reponame>apampuch/PySRCG
from abc import ABC
from tkinter import *
from tkinter import ttk
from src import app_data
from src.CharData.accessory import *
from src.CharData.vehicle import Vehicle
from src.Tabs.three_column_buy_tab import ThreeColumnBuyTab
class VehicleAccessoriesTab(ThreeColumnBuyTab, ABC):
def _... | StarcoderdataPython |
91705 | from __future__ import division, print_function
__author__ = 'saeedamen' # <NAME> / <EMAIL>
#
# Copyright 2017 Cuemacro Ltd. - http//www.cuemacro.com / @cuemacro
#
# See the License for the specific language governing permissions and limitations under the License.
#
import os
from collections import OrderedDict
im... | StarcoderdataPython |
55584 | from setuptools import setup
setup(name='geo',
version='0.1',
description='Useful geoprospection processing methods',
author='<NAME>',
author_email='<EMAIL>',
license='MIT',
packages=['geo'],
zip_safe=False)
| StarcoderdataPython |
3274238 | from rest_framework import serializers
from koalixcrm.accounting.accounting.product_category import ProductCategory
from koalixcrm.accounting.rest.product_categorie_rest import ProductCategoryMinimalJSONSerializer
from koalixcrm.crm.product.product_type import ProductType
from koalixcrm.crm.product.tax import Tax
from... | StarcoderdataPython |
141501 | <reponame>EricRemmerswaal/tensorflow<gh_stars>1000+
# Copyright 2019 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org... | StarcoderdataPython |
1691775 | import asyncio
import datetime
import json
import logging
import os
import queue
import re
import sys
import threading
import time
import typing
from dataclasses import dataclass
import aiofiles
import requests
logger = logging.getLogger(__name__)
VmGuid = str
@dataclass
class VMInfo:
id: VmGuid
name: str
... | StarcoderdataPython |
1791972 | #!/usr/bin/env python
"""
Created on Fri Oct 7 13:27:14 2016
@author: dennis
"""
import numpy as np
from tf.transformations import *
from geometry_msgs.msg import Point, Vector3
from geometry_msgs.msg import Quaternion
def is_at_orientation(q_current, q_desired, offset_rad):
q_des= np.array((q_desired.x, q_desi... | StarcoderdataPython |
3371578 | <gh_stars>0
from urllib.error import URLError
from urllib.request import urlopen
import re
import pymysql
import ssl
from pymysql import Error
def decode_page(page_bytes, charsets=('utf-8',)):
"""通过指定的字符集对页面进行解码(不是每个网站都将字符集设置为utf-8)"""
page_html = None
for charset in charsets:
try:
p... | StarcoderdataPython |
1742619 | import pygame
import random
import math
import os
pygame.init()
PATH = os.getcwd().replace('\\', '/')
img = pygame.image.load('./img/icon.png')
pygame.display.set_icon(img)
class DrawInformation:
BLACK = 0, 0, 0
WHITE = 255, 255, 255
RED = 255, 0, 0
GREEN = 0, 255, 0
BLUE = 0, 0, 255
BACKGROU... | StarcoderdataPython |
3247843 | import inflection
class ClassDefinitionError(ValueError):
...
class OrphanedListenersError(ClassDefinitionError):
...
class MissingGetterSetterTemplateError(ClassDefinitionError):
...
class InvalidPostCoerceAttributeNames(ClassDefinitionError):
...
class CoerceMappingValueError(ClassDefinition... | StarcoderdataPython |
1696849 | from bioimageio.spec.model import raw_nodes
def test_load_raw_model(unet2d_nuclei_broad_any):
from bioimageio.spec import load_raw_resource_description
raw_model = load_raw_resource_description(unet2d_nuclei_broad_any)
assert raw_model
def test_loaded_remote_raw_model_is_valid(unet2d_nuclei_broad_url):... | StarcoderdataPython |
1705658 | <gh_stars>0
import os
import json
from tqdm import tqdm
import pandas as pd
def concat_text_and_save_as_jsonlist(df, outfile, text_cols):
"""
Save the dataframe as a jsonlist.
It ends up being expensive to concatenate the dataframe columns, so we do it
line by line as we save
"""
with open(ou... | StarcoderdataPython |
1621443 | import keras
# import keras_retinanet
from keras_retinanet import models
from keras_retinanet.utils.image import read_image_bgr, preprocess_image, resize_image
from keras_retinanet.utils.visualization import draw_box, draw_caption
from keras_retinanet.utils.colors import label_color
# import miscellaneous modules
imp... | StarcoderdataPython |
134882 | <filename>pytrx/transformation.py
# -*- coding: utf-8 -*-
"""
Created on Thu Jun 4 17:33:17 2016
@author: darren
A library of predefined moves for the Molecule class.
"""
import numpy as np
import math
import copy
from pytrx.utils import AtomicMass
from abc import (ABC as _ABC, abstractmethod as _abstractmethod)
... | StarcoderdataPython |
3251660 | """
tracked_object.py defines TrackedObj -> a datatype which tracks on object methods
"""
import numpy as np
import operator
import functools
import copy
import math
from collections.abc import Iterable
import uuid
def reset_array_prov(array, array_id = None):
if array_id == None:
array_id = uuid.uuid4... | StarcoderdataPython |
126622 | from bluetooth_shower_head import bluetoothManager_head
from bluetooth_scale import bluetoothManager_scale
from influx_poster import database_post
import signal
import sys
import time
if __name__ == '__main__':
runtime = 480
try:
database_post("indicator", 1.0, "startstop").start()
print("instatiati... | StarcoderdataPython |
3395917 | import numpy as np
from skimage import exposure
def image_from_separated_rgb(image_r, image_g, image_b, clip_min_pct=2, clip_max_pct=98, equalize_hist=True):
'''
return array(m, n, 3) of RGB image (0-255)
'''
image_b = np.clip(image_b, np.percentile(image_b, clip_min_pct), np.percentile(image_b,... | StarcoderdataPython |
166255 | from django.db import models
from django.db.models import Sum, Q
from django.utils import timezone
from decimal import Decimal
class LedgerAccount(models.Model):
"""A particular account in the accounting ledger system.
All transactions must have a left side (debit) and a right side (credit),
and they mu... | StarcoderdataPython |
1770868 | <gh_stars>1-10
import unittest
import numpy as np
from intfft import fft, ifft
class TestFFT(unittest.TestCase):
# confirm the input arguments .
def _test_fft_input_type(self, dtype):
xr1 = np.arange(2**7, dtype=dtype)
xi1 = np.arange(2**7, dtype=dtype)
_, _ = fft(xr1, xi1)
def test... | StarcoderdataPython |
106546 | <gh_stars>10-100
from glob import glob
from os import chdir, getcwd, makedirs, path
from subprocess import call
from .get_app import get_app_name
from .logic import check_app_path, check_injection, check_pkg_injection
C_None = "\x1b[0;39m"
C_BRed = "\x1b[1;31m"
def remove_app_injection(args):
# 1 | Check for v... | StarcoderdataPython |
1677995 | <gh_stars>1-10
from pyramid.httpexceptions import HTTPBadRequest
from chsdi.lib.helpers import get_from_configuration
from chsdi.lib.helpers import float_raise_nan
class HeightValidation:
def __init__(self):
self._lon = None
self._lat = None
self._elevation_models = None
@property
... | StarcoderdataPython |
103044 | <gh_stars>1-10
# Generated by Django 3.2.7 on 2021-10-05 19:06
import django.core.validators
from django.db import migrations, models
from django.db.migrations.operations.fields import RemoveField
import django.db.models.deletion
from supplemental_content.models import AbstractModel
def make_category(id, title, desc... | StarcoderdataPython |
3375273 | import json
import sys
import time
import os
import boto3
rek = boto3.client('rekognition')
sqs = boto3.client('sqs')
sns = boto3.client('sns')
s3 = boto3.client('s3')
start_job_id = ''
def GetJobID(event):
'''
Get the Identity code from the Queue
'''
for record in event['Records']:
body = js... | StarcoderdataPython |
191284 | <gh_stars>0
import pytest
from serverless_tasks import task
# Prove that a task behaves like a normal function when called
# like a normal function
def test_a_task_can_be_called_normally():
@task()
def a_function():
return 42
assert a_function() == 42
def test_a_task_can_be_called_with_args()... | StarcoderdataPython |
198642 |
#%%
from datetime import datetime
import pandas as pd
import numpy as np
from pandas.core import frame
import geopandas as gpd
import seaborn as sns
import matplotlib.pyplot as plt
from scipy import stats
import statsmodels.api as sm
# %%
def process_index_pivot(vi_link, v_index):
v_index = str(v_index)
... | StarcoderdataPython |
3322325 | <reponame>acc-cosc-1336-spring-2022/acc-cosc-1336-spring-2022-DaltonTaff
import unittest
from src.homework.i_dictionaries_sets.dictionary import get_p_distance
from src.homework.i_dictionaries_sets.dictionary import get_p_distance_matrix
class Test_Config(unittest.TestCase):
def test_p_distance(self):
li... | StarcoderdataPython |
1629277 | <filename>experiment.py
'''
Created on 08.06.2015
@author: marinavidovic
'''
import os
import utils
import motif
from datetime import datetime
import pdb
import numpy as np
from openopt import NLP
import func
import grad
import pickle
import view
class Experiment:
'''
classdocs
'''
num_motifs = 1
... | StarcoderdataPython |
3248141 | from random import randint
def generate_auth_code() -> str:
"""
Generate a six-numbers random code.
"""
code = ''
for _ in range(6):
code += str(randint(0, 9))
return code
class Get_Auth_Code:
"""
Monostate for storing a generated code
"""
_state: dict = {
'A... | StarcoderdataPython |
1799344 | <filename>main.py
from numpy import cos, sin, pi
import matplotlib.pyplot as plt
import functions as func
np = func.np
'''
Constantes
'''
phi = -28.93 / 180*pi # Latitude do local (negativo se for latitude Sul).
e = 23.4 / 180*pi # Obliquidade da eclíptica.
w_s = 850 # Constante solar na superfície da Terra em W/s.
... | StarcoderdataPython |
3397007 | <filename>task_adaptation/data/clevr_test.py
# coding=utf-8
# Copyright 2019 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#... | StarcoderdataPython |
1794003 | <filename>mods/tests/mocks/BirModule/back/module.py
from libvis.modules.Base import BaseModule
from .bottles import beer
class Bir(BaseModule):
name="BirModule"
def __init__(self, count):
super().__init__()
self.text = beer(count)
def vis_set(self, key, value):
super().vis_set(key,... | StarcoderdataPython |
126539 | <gh_stars>0
class ClassDictionary:
def __init__(self, value):
self.dict_value = value
def __getattribute__(self, name):
if name == "dict_value":
return super().__getattribute__(name)
result = self.dict_value.get(name)
return result
def __setattr__(self, name, v... | StarcoderdataPython |
3289374 | <filename>tests/khmer_tst_utils.py
#
# This file is part of khmer, http://github.com/ged-lab/khmer/, and is
# Copyright (C) Michigan State University, 2009-2013. It is licensed under
# the three-clause BSD license; see doc/LICENSE.txt.
# Contact: <EMAIL>
#
import tempfile
import os
import shutil
thisdir = os.path.dirn... | StarcoderdataPython |
110418 | #program to locate Python site-packages.
import site
def main():
return (site.getsitepackages())
print(main()) | StarcoderdataPython |
1756179 | import matplotlib.colors as colors
import matplotlib.cm as cmx
import matplotlib.pyplot as plt
import cv2
import scipy.io as sio
import numpy as np
img=cv2.imread('./att_seg_rgb.jpg')
# img=img.transpose((1,2,0))
print(img.shape)
att_dict=sio.loadmat('/data2/gyang/PGA-net/segmentation/sp_ag_weights_2020-06-05-16-13-46.... | StarcoderdataPython |
4814858 | <reponame>p517332051/face_benchmark
from .OctResNet import *
from .Octconv import OctaveConv,Conv_BN_ACT,Conv_BN,Conv_ACT | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.