id stringlengths 2 8 | text stringlengths 16 264k | dataset_id stringclasses 1
value |
|---|---|---|
5164617 | from . import test_event_sale
from . import test_event_sale_ui
| StarcoderdataPython |
275748 | <filename>beekeeper/hive.py
"""
Provides the Hive class to work with JSON hive files, both remotely
retrieved and opened from a local file
"""
from __future__ import division
try:
from urllib2 import URLError
except ImportError:
from urllib.error import URLError
import json
import os
from beekeeper.comms imp... | StarcoderdataPython |
370074 | <gh_stars>1-10
# -*- coding: UTF-8 -*-
# **********************************************************************************#
# File: PMS gateway file
# Author: Myron
# **********************************************************************************#
from utils.dict import (
DefaultDict,
CompositeDict
)
... | StarcoderdataPython |
4936028 | # Copyright (c) 2019 Cisco and/or its affiliates.
# 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 ag... | StarcoderdataPython |
1883243 | <filename>tests/conftest.py
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import logging
import pytest
from rasa_nlu import data_router, config
from rasa_nlu.components import ComponentBuilder
logging.basicConfig(... | StarcoderdataPython |
11303029 | """Python Protocol API v3 type definitions and value classes."""
from opentrons_shared_data.labware.dev_types import LabwareParameters
from opentrons.types import (
DeckSlotName,
Location,
MountType as Mount,
Mount as DeprecatedMount,
Point,
)
from opentrons.protocol_engine import DeckSlotLocation... | StarcoderdataPython |
6543321 | <filename>model_compiler/tests/model_compiler/models/targets/test_tensorrt_model.py
# Copyright 2019 ZTE corporation. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
import os
from tempfile import TemporaryDirectory
from unittest import TestCase
import numpy
import pytest
import tensorflow as tf
import ten... | StarcoderdataPython |
9673541 | <gh_stars>10-100
"""
Django settings for ponyconf project.
"""
from django.utils.translation import ugettext_lazy as _
import os
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# SECURITY WARNING: keep the secret key used... | StarcoderdataPython |
1687984 | from dataclasses import dataclass
from enum import Enum
from pathlib import Path
from typing import Optional
import typer
from pydantic import DirectoryPath, FilePath, HttpUrl
from typing_extensions import Literal
from judge.tools.config import BaseJudgeConfig
@dataclass(frozen=True)
class Sample:
ext: Literal[... | StarcoderdataPython |
124235 | <reponame>bcgov/CIT<gh_stars>1-10
from django.test import TestCase
from django.contrib.gis.geos import Point
from ...models import Opportunity, ApprovalStatus
class OpportunityModelTest(TestCase):
def test_fields(self):
approval_status = ApprovalStatus(status_name="Test status",
... | StarcoderdataPython |
3543176 | <gh_stars>1-10
/usr/lib64/python3.5/bisect.py | StarcoderdataPython |
3245374 | import sqlite3
def create_db(db_name):
with sqlite3.connect(db_name) as db:
cursor = db.cursor()
cursor.execute("""CREATE TABLE Tasks(
TaskID integer,
Description text,
ProjectID integer,
... | StarcoderdataPython |
6575236 | <reponame>james94/driverlessai-recipes
"""Extract LIEF features from PE files"""
from h2oaicore.transformer_utils import CustomTransformer
import datatable as dt
import numpy as np
class PEImportsFeatures(CustomTransformer):
_modules_needed_by_name = ['lief==0.9.0']
_regression = True
_binary = True
_... | StarcoderdataPython |
11283309 | <reponame>mlcommons/peoples-speech
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
# Copyright (C) 2017 Intellisist, Inc. (Author: <NAME>)
#
# 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 L... | StarcoderdataPython |
12840372 | """
@Author : xiaotao
@Email : <EMAIL>
@Lost modifid : 2020/4/24 10:18
@Filename : LanguagePack.py
@Description :
@Software : PyCharm
"""
class RET:
"""
语言类包
"""
OK = "200"
DBERR = "501"
NODATA = "462"
DATAEXIST = "433"
DATAERR = "499"
REQERR = "521"
IPERR = ... | StarcoderdataPython |
6689083 | import os
import sys
import json
import numpy as np
import torch
from torch import nn
from torch import optim
from torch.utils.tensorboard import SummaryWriter
from torch.optim import lr_scheduler
from pathlib import Path
from opts import parse_opts
from model import generate_model
from mean import get_mean, get_std
f... | StarcoderdataPython |
5085457 | #!/usr/bin/env python
from distutils.core import setup
from distutils.extension import Extension
from Cython.Build import cythonize
import numpy as np
import os
import sys
from numpy.distutils.system_info import get_info
# try to find LAPACK and BLAS
blas_info = get_info('blas_opt')
if sys.platform == 'darwin':
#... | StarcoderdataPython |
1600978 | from dist_zero.types import Type
from dist_zero import errors, primitive
class Expression(object):
'''
Abstract base class for the core expression objects. These form the starting point for the DistZero compiler.
'''
def __init__(self):
self.spy_keys = set()
def Spy(self, key):
self.spy_keys.add(... | StarcoderdataPython |
3274895 | <reponame>jpenrici/Extensions_Inkscape
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
# Extensão para o Inkscape randomizar as cores RGB, o preenchimento e/ou
# contorno de objetos selecionados.
import random
import inkex
import simplestyle
class RandomRGB(inkex.Effect):
def __init__... | StarcoderdataPython |
4860367 | #!/usr/bin/env python3
#
# Copyright (c) 2014-present, Facebook, Inc.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
#
from __future__ import absolute_import, division, print_function, unicode_literals
from builtins import object, str
fro... | StarcoderdataPython |
11255229 | from wepay.tests import CallBaseTestCase
class SubscriptionPlanTestCase(CallBaseTestCase):
def test_subscription_plan(self):
args = [
('subscription_plan_id', 12345)
]
kwargs = {}
self._test_call('/subscription_plan', args, kwargs)
def test_subscription_plan_find(s... | StarcoderdataPython |
354105 | """
Base classes for collections of samples.
| Copyright 2017-2020, Voxel51, Inc.
| `voxel51.com <https://voxel51.com/>`_
|
"""
import inspect
import logging
import os
import random
import string
import eta.core.serial as etas
import eta.core.utils as etau
from fiftyone.core.aggregations import Aggregation
import fi... | StarcoderdataPython |
11314505 | from concurrent.futures.thread import ThreadPoolExecutor
from datetime import datetime
import time
from urllib.parse import unquote
from baike import url_manager, html_downloader, html_parser, html_outputer
class SpiderMain(object):
def __init__(self):
self.urls = url_manager.UrlManager()
self.do... | StarcoderdataPython |
8078023 | <gh_stars>0
from kaggle.api.kaggle_api_extended import KaggleApi
import zipfile
import os
from shutil import copyfile
from random import random
from random import seed
DATASET = "alessiocorrado99/animals10"
# requires /.kaggle/kaggle.json
def fetch_kaggle():
api = KaggleApi()
api.authenticate()
api.data... | StarcoderdataPython |
6540006 | import shapely
from shapely.geometry import shape, Polygon,box, JOIN_STYLE
from shapely.ops import cascaded_union
import pdb
import math
from operator import itemgetter
# Calculation
def building(xmin,ymin,xmax,ymax,polys_design):
gsize = 10
x_num = math.ceil((xmax-xmin) / gsize)
y_num = math.ceil((ym... | StarcoderdataPython |
4829198 | <gh_stars>1-10
"""
setup.py - Setup file to distribute the library
See Also:
https://github.com/pypa/sampleproject
https://packaging.python.org/en/latest/distributing.html
https://pythonhosted.org/an_example_pypi_project/setuptools.html
"""
import os
import glob
from setuptools import setup, Extension, fin... | StarcoderdataPython |
6552255 | import logging
from numpy.random import uniform, randint
from problems.test_case import TestCase, TestCaseTypeEnum
from problems.solutions.compound_interest import compound_interest
logger = logging.getLogger(__name__)
FUNCTION_NAME = "compound_interest"
INPUT_VARS = ["amount", "rate", "years"]
OUTPUT_VARS = ["new_... | StarcoderdataPython |
3383987 | """Views for social interactions."""
from django.views.generic import TemplateView
from django.core.urlresolvers import reverse
from django.utils.html import strip_tags
from django.utils.safestring import mark_safe
from django.shortcuts import redirect
from django.contrib import messages
from braces.views import Logi... | StarcoderdataPython |
8051717 | from ..db import ZipDetail, Base
from .base import session
def validate(pincode: int) -> bool:
"""
Description
-----------
Verify if a pincode is correct or not:
Parameters
----------
pincode : int
The pincode of district
Returns
-------
bool
True if pincode i... | StarcoderdataPython |
1901442 | <reponame>minsukkahng/pokr.kr<gh_stars>10-100
# -*- coding: utf-8 -*-
import redis
class RedisQueue(object):
"""Simple Queue with Redis Backend"""
def __init__(self, name, namespace='queue', **redis_kwargs):
"""The default connection parameters are: host='localhost', port=6379, db=0"""
self.db... | StarcoderdataPython |
9652603 | <filename>gsmodutils/test/instances.py<gh_stars>10-100
from abc import ABCMeta, abstractmethod
from six import exec_, add_metaclass
import sys
import os
import traceback
from gsmodutils.test.utils import stdout_ctx, ModelLoader, ResultRecord
import jsonschema
from cobra.exceptions import Infeasible
import cobra
from co... | StarcoderdataPython |
4896540 | from http import HTTPStatus
import pytest
import requests
from rotkehlchen.tests.utils.api import api_url_for, assert_error_response, assert_proper_response
from rotkehlchen.tests.utils.constants import A_RDN
from rotkehlchen.tests.utils.factories import UNIT_BTC_ADDRESS1, UNIT_BTC_ADDRESS2
from rotkehlchen.tests.uti... | StarcoderdataPython |
5141574 | <reponame>vtsuperdarn/deep_leaning_on_GSP_TEC<gh_stars>1-10
'''
This file gets the predicted tec maps by first loading the saved model and then running on the test input.
'''
from st_resnet import STResNetShared, STResNetIndep
import tensorflow as tf
from params import Params as param
import pandas as pd
import numpy ... | StarcoderdataPython |
55979 | from .utils import *
from .enums import * | StarcoderdataPython |
3543309 | <reponame>Alicegif/covid19-severity-prediction
#! /usr/bin/python3
import pandas as pd
import os
from os.path import join as oj
from os.path import dirname
if __name__ == '__main__':
import sys
sys.path.append(oj(os.path.dirname(__file__), '../../raw/usafacts_infections/'))
from load import load_usafacts_... | StarcoderdataPython |
9643390 | import pygame
import pygame.font
class Button:
def __init__(self,game,txt):
self.screen = game.screen
self.screen_rect = self.screen.get_rect()
self.width, self.height = 200, 50
self.button_color = (0,153,0) #RGB
self.txt_color = (160,160,160)
self.font = pygame.fon... | StarcoderdataPython |
37195 | # if语句
games = ['CS GO', 'wow', 'deathStranding']
for game in games:
if game == 'wow': # 判断是否相等用'=='
print(game.upper())
# 检查是否相等
sport = 'football'
if sport == 'FOOTBALL':
print('yes')
else:
print('No') # 此处输出结果为No说明大小写不同不被认同是同一string、转化为小写在进行对比
for game in games:
if game.lower() == 'cs ... | StarcoderdataPython |
1947395 | <filename>cifar10_data.py
"""
cifar-10 dataset, with support for random labels
"""
import numpy as np
import torch
import torchvision.datasets as datasets
class CIFAR10RandomLabels(datasets.CIFAR10):
"""CIFAR10 dataset, with support for randomly corrupt labels.
Params
------
corrupt_prob: float
Default ... | StarcoderdataPython |
11275046 | <reponame>Hidberg/Landmark2019-1st-and-3rd-Place-Solution
import itertools
import random
import math
import albumentations.augmentations.functional as F
import cv2
from PIL import Image
import numpy as np
import torch
from albumentations import ImageOnlyTransform
from torch.optim.lr_scheduler import _LRScheduler
from... | StarcoderdataPython |
9600721 | <reponame>qiskit-community/repo-monitor<filename>tests/test_utils.py
"""Tests for utils."""
import unittest
from typing import Optional, Union
from monitor.utils import UrlsHelper, GitHubUrlsHelper
class MockUrlsHelper(UrlsHelper):
"""Mock urls helpder for testing purposes."""
def get_comments_url(self, acc... | StarcoderdataPython |
6645249 | <reponame>pomarec/django
from django.conf.urls import patterns, url
from .views import empty_view
urlpatterns = patterns('',
url(r'^$', empty_view, name="named-url5"),
url(r'^extra/(?P<extra>\w+)/$', empty_view, name="named-url6"),
url(r'^(?P<one>\d+)|(?P<two>\d+)/$', empty_view),
)
| StarcoderdataPython |
6483169 | <filename>research/cv/centernet_resnet50_v1/postprocess.py
# Copyright 2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LIC... | StarcoderdataPython |
1932671 | '''
scikit-learn 패키지에 포함된 위스콘신 대학 암 데이터를 로딩해서
Naive Bayes 모델로 예측 결과를 분석.
'''
import pandas as pd
from sklearn import datasets
from sklearn.metrics import classification_report
from sklearn.metrics import confusion_matrix
from sklearn.model_selection import train_test_split
from sklearn.naive_bayes import GaussianNB
f... | StarcoderdataPython |
201470 | <gh_stars>1-10
import collections
import datetime
from django.utils.translation import ugettext_lazy as _
from .base import * # noqa
# Override static and media URL for prefix in WSGI server.
# https://code.djangoproject.com/ticket/25598
STATIC_URL = '/2016/static/'
MEDIA_URL = '/2016/media/'
CONFERENCE_DEFAULT... | StarcoderdataPython |
24235 | <reponame>dangthanhan507/odcl
import cv2
import os
import argparse
if __name__ == '__main__':
arg = argparse.ArgumentParser()
arg.add_argument('--o', required=True, help='output_folder')
opt = arg.parse_args()
cap = cv2.VideoCapture(0)
ret, img = cap.read()
print('Writing to chessboard file')
files = os.listdir... | StarcoderdataPython |
6653780 | import subprocess
import os
import json
import argparse
from draco.spec import Query, Task
import logging
logger = logging.getLogger(__name__)
logger.setLevel(logging.ERROR)
DATA_FIELD_TYPES = ['string', 'string', 'string', 'number', 'string',
'number', 'string', 'number', 'number', 'number',
... | StarcoderdataPython |
9648011 | import sys
import numpy as np
import math
import pickle
unique_entity_fp = sys.argv[1]
concatenated_embedding_fp = sys.argv[2]
ds_name = sys.argv[3]
def sigmoid(x):
return 1 / (1 + math.exp(-x))
# prepare unique entity list
unique_entity_list = []
with open(unique_entity_fp) as fp:
for line in fp:
uniq... | StarcoderdataPython |
71224 | <reponame>josalinas/ppiclF
import unittest
import inspect
import os
from functools import wraps
###############################################################################
# DECORATORS
###############################################################################
def Parallel(method):
@wraps(method)
def... | StarcoderdataPython |
11375247 | from rest_framework.fields import get_attribute
from rest_framework import relations
from rest_framework.reverse import reverse
class GenericHyperlinkedRelatedField(relations.PrimaryKeyRelatedField):
def get_attribute(self, instance):
return get_attribute(instance, self.source_attrs)
def to_represent... | StarcoderdataPython |
8015340 | from table2json.bin.main import execute_from_command_line
__all__ = [
"execute_from_command_line",
]
| StarcoderdataPython |
40385 | import sys
import random
from test_base import *
class TestBlockLD(TestBase):
def generate(self):
self.clear_tag()
for n in range(50000):
store_not_load = random.randint(0,1)
tag = random.randint(0, 15)
index = random.randint(0,self.sets_p-1)
taddr = self.get_addr(tag,index)
... | StarcoderdataPython |
1785313 | <reponame>pld/bamboo<gh_stars>10-100
from functools import partial
import simplejson as json
import os
import tempfile
from celery.exceptions import RetryTaskError
from celery.task import task
import pandas as pd
from bamboo.lib.async import call_async
from bamboo.lib.datetools import recognize_dates
from bamboo.lib.... | StarcoderdataPython |
9658638 | <filename>src/fedAVG/server.py
from copy import deepcopy
import random
import numpy
import torch
import torch.nn as nn
import torch.optim as optim
from .client import Client
from ..models import *
from ..utils import get_class_priors, load_cifar, run_accuracy, generate_clients_sizes
from ..splits import indexes_split_... | StarcoderdataPython |
1769790 | <reponame>basarane/model-based-rl<filename>src/nets/loss.py
import numpy as np
import tensorflow.keras.backend as K
if K.backend() == 'tensorflow':
import tensorflow as tf
elif K.backend() == 'theano':
from theano import tensor as T
# adapted from keras-rl: https://github.com/keras-rl/keras-rl/blob/master/rl/util.p... | StarcoderdataPython |
1886921 | from asserts import assert_equal
from dectest import TestCase, test
from werkzeug import Request
from rouver.util import absolute_url
class AbsoluteURLTest(TestCase):
@staticmethod
def _create_request(*, path_info: str = "/path") -> Request:
return Request(
{
"wsgi.url_sch... | StarcoderdataPython |
264778 | # Copyright 2019-2021 VMware, Inc.
# SPDX-License-Identifier: Apache-2.0
from django.contrib import admin
# Register your models here.
| StarcoderdataPython |
9633823 | name = "muDIC"
from .solver import DICInput
from muDIC.post.viz import Fields, Visualizer
from muDIC.solver.correlate import DICInput, DICOutput
from . import IO
from . import elements
from . import filtering
from . import mesh
from . import mesh
from . import post
from . import vlab
from . import utils
from .IO import... | StarcoderdataPython |
3378007 | <gh_stars>0
from numba.core import dispatcher, compiler
from numba.core.registry import cpu_target, dispatcher_registry
import numba.dppl_config as dppl_config
class DpplOffloadDispatcher(dispatcher.Dispatcher):
targetdescr = cpu_target
def __init__(self, py_func, locals={}, targetoptions={}, impl_kind='dire... | StarcoderdataPython |
8193077 | <gh_stars>0
from wpcv import plp as plp
import os,glob
def resnet(data_dir=None,name='resnet18',pretrained=True,num_classes='auto',input_size=(224,224),batch_size=8,num_epoch=200,patience=20,shuffle=True):
trainer = plp.ClassifierTrainer()
if num_classes=='auto':
num_classes=len(os.listdir(data_dir+'/train'))
... | StarcoderdataPython |
3202613 | <gh_stars>1-10
from itertools import permutations
if __name__ == '__main__':
x = int(input())
y = int(input())
z = int(input())
n = int(input())
take_it= []
keep=permutations((x,y,z))
count=0
for i in list(keep):
for j in i:
count+=j
if count is n:
... | StarcoderdataPython |
119880 | import asyncio
import base64
import binascii
import json
import logging
import os
import sys
from urllib.parse import urlparse
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from runners.agent_container import ( # noqa:E402
arg_parser,
create_agent_with_args,
AriesAgent,
)
f... | StarcoderdataPython |
54717 | import operator
from itertools import chain
from Logic.ProperLogic.helper_classes.reducer import MaxReducer
from Logic.ProperLogic.misc_helpers import log_error
class ClusterDict(dict):
# TODO: Make sure constructor is only called when needed / doesn't produce more work than necessary!
def __init__(self, cl... | StarcoderdataPython |
333341 | import logging
import random
import numpy as N
class Cpu:
def __init__(self):
# memory 4kbs
self.memory = [0] * 4096
# data registers (8-bit)
self.V = [0] * 16
# address register (16-bit)
self.I = 0
# timers (8-bit)
self.delay = 0
self.sou... | StarcoderdataPython |
6570071 | lista = ('Lapis', 1.70,
'Borracha', 2,
'Caderno', 10.40,
'Mochila', 80.76,
'Caneta', 1.50)
print(f'{"Lista de Preços":^28}')
for n in range(0, len(lista)):
if n % 2 == 0:
print(f'{lista[n]:.<20}', end='')
else:
print(f'{lista[n]:>7.2f}')
'''Sempre que precisar... | StarcoderdataPython |
6673314 | <filename>solutions/500.keyboard-row.241401967.ac.py
class Solution(object):
def findWords(self, words):
"""
:type words: List[str]
:rtype: List[str]
"""
row3 = set("ZXCVBNMzxcvbnm")
row1 = set("QWERTYUIOPqwertyuiop")
row2 = set("ASDFGHJKLasdfghjkl")
... | StarcoderdataPython |
8077564 | import pytest
import torch
from ding.rl_utils.upgo import upgo_loss, upgo_returns, tb_cross_entropy
@pytest.mark.unittest
def test_upgo():
T, B, N, N2 = 4, 8, 5, 7
# tb_cross_entropy: 3 tests
logit = torch.randn(T, B, N, N2).softmax(-1).requires_grad_(True)
action = logit.argmax(-1).detach()
ce =... | StarcoderdataPython |
11250139 | <gh_stars>1-10
#! /usr/bin python
####################################################################
# sendSMS.py
# Send the SMS
# <NAME>
# April 22, 2016
# Contact: <EMAIL>
# Description: Keeps listening to new SMSes and whenever an SMS is received it
# prints it to console.
########################################... | StarcoderdataPython |
6404744 | from rest_framework import serializers
from geodata.models import GeodataModelRu, GeodataModelRuAlternate
class GeodataModelRuSerializer(serializers.ModelSerializer):
class Meta:
model = GeodataModelRu
fields = (
'__all__'
)
class GeodataCitiesSerializer(serializers.ModelSeri... | StarcoderdataPython |
4893149 | <reponame>fullbat/scilpy
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Apply bias field correction to DWI. This script doesn't compute the bias
field itself. It ONLY applies an existing bias field. Use the ANTs
N4BiasFieldCorrection executable to compute the bias field
"""
from __future__ import division
from pas... | StarcoderdataPython |
3377021 | <filename>mirumon/api/asgi.py<gh_stars>10-100
from fastapi import FastAPI
from mirumon.api import routers
from mirumon.infra.components.server_events import (
create_shutdown_events_handler,
create_startup_events_handler,
)
from mirumon.settings.environments.app import AppSettings
def create_app(settings: Ap... | StarcoderdataPython |
6447246 | <filename>spreadsheet_coder/model.py
# coding=utf-8
# Copyright 2021 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENS... | StarcoderdataPython |
1734107 | __author__ = 's7a'
# The Sanitizer class
class Sanitizer:
# Constructor for the sanitizer class
def __init__(self):
# Unused
pass
# Sanitize a given word
@staticmethod
def sanitize_word(word):
word = word.lower()
alphabets = "abcdefghijklmnopqrstuvwxyz"
re... | StarcoderdataPython |
3454443 | import sys
# TODO: add option or in other way allow developer to enable debug logging.
if False:
import logging
logging.basicConfig(level=logging.DEBUG)
def pytest_cmdline_preparse(args):
if sys.version_info[:2] == (3, 5):
# Disable pylint on Python 3.5, since it's broken:
# <https://bitb... | StarcoderdataPython |
4891730 | a3 = [258,3]
print(bytearray(a3))
| StarcoderdataPython |
1812088 | <reponame>gregdavill/rpc-dram-playground<filename>gsd_orangecrab.py
#
# This file is part of LiteX-Boards.
#
# Copyright (c) 2020 <NAME> <<EMAIL>>
# SPDX-License-Identifier: BSD-2-Clause
from litex.build.generic_platform import *
from litex.build.lattice import LatticePlatform
from litex.build.dfu import DFUProg
# IO... | StarcoderdataPython |
3369788 | '''
May 2020 by <NAME>
<EMAIL>
https://www.github.com/sebbarb/
'''
import feather
import pandas as pd
import numpy as np
from hyperparameters import Hyperparameters
from pdb import set_trace as bp
def main():
hp = Hyperparameters()
# Load data
#df = feather.read_dataframe(hp.data_di... | StarcoderdataPython |
11340097 | <filename>src/segmentation/SegmentationTransformer.py<gh_stars>1-10
import time
from sklearn.pipeline import Pipeline
from src.segmentation.VCReaderTransformer import VCReaderTransformer
from src.segmentation.AutographerImageExtractorTransformer import AutographerImageExtractorTransformer
from src.segmentation.DaysEx... | StarcoderdataPython |
397701 | <filename>utils/cryptoFunc.py
# coding=utf-8
import hashlib
from Crypto.Cipher import DES, AES
import base64
mdes = DES.new(b'!z*EaY0e', 1)
def decode_base64(text, user_agent=""):
if not text: return text
if 'iOS' in user_agent or "CFNetwork" in user_agent:
dec_text = aes_func.decrypt(text)
els... | StarcoderdataPython |
1900153 | import os
try:
import configparser
except ImportError:
import ConfigParser as configparser
try:
UNICODE_EXISTS = bool(type(unicode))
except NameError:
unicode = lambda s: str(s)
from collections import namedtuple
import click
APP_NAME = "zotcli"
Item = namedtuple("Item", ("key", "creator", "title", "... | StarcoderdataPython |
3422685 | import os
from io import StringIO
from pathlib import Path
from quom import Quom
from quom.__main__ import main
FILE_MAIN_HPP = """
int foo = 3;
int foo();
"""
FILE_MAIN_CPP = """
int foo() { return 42; }
"""
RESULT = """
int foo = 3;
int foo();
int foo() { return 42; }
"""
def test_source_directory(fs):
o... | StarcoderdataPython |
6508037 | import os
import requests
import json
server_ip = "172.16.17.32"
creds_name = "<NAME>"
username = "ubuntu"
privateKey = "paste your SSH private key here"
base_url = 'http://%s:8888/api/v2/lcm/' % server_ip
opscenter_session = os.environ.get('opscenter_session', '')
def do_post(url, post_data):
result = requests.... | StarcoderdataPython |
12853918 | from django.urls import path, re_path
from drf_yasg import openapi
from drf_yasg.views import get_schema_view
from rest_framework.routers import SimpleRouter, DefaultRouter
from rest_framework_simplejwt import views as jwt_views
from api.views import *
# роутер нужен, чтобы сгенерить урлы под вью сет и самому их не ... | StarcoderdataPython |
6511037 | <filename>rules/ordinal_mappings/advapi32.py
mapping = {
1001:'I_ScGetCurrentGroupStateW',
1005:'AbortSystemShutdownA',
1006:'AbortSystemShutdownW',
1007:'AccessCheck',
1008:'AccessCheckAndAuditAlarmA',
1009:'AccessCheckAndAuditAlarmW',
1010:'AccessCheckByType',
1011:'AccessCheckByTypeAndAuditAlarmA',
1012:'AccessCheck... | StarcoderdataPython |
3531007 | from compas.datastructures import Mesh
import meshcat
import meshcat.geometry as mcg
import uuid
import numpy as np
from meshcat import Visualizer
from meshcat.animation import Animation
import pymesh
import os
def compas_mesh_to_obj_str(mesh):
lines = ["g object_1"]
v, f = mesh.to_vertices_and_faces()
for... | StarcoderdataPython |
11321241 | <filename>simuvex/simuvex/engines/vex/statements/mbe.py
print '... Importing simuvex/engines/vex/statements/mbe.py ...'
from angr.engines.vex.statements.mbe import *
| StarcoderdataPython |
1725117 | import os
dir_path = "/Users/wonder/Documents/GitHub/WonderGame/Aircraft War/img/Explosion"
file_names = os.listdir(dir_path)
print(file_names)
n = 0
for file in file_names:
print(file)
file_parts = file.split('.')
print(file_parts[0])
if file_parts[1] == 'tiff':
new_name = file_parts[0] + '.p... | StarcoderdataPython |
9783811 | <gh_stars>10-100
import judy
vout = judy.VoiceOut(device='plughw:0,0',
resources='/home/pi/judy/resources/audio')
vout.beep(1)
vout.beep(0)
vout.say('How are you today?')
| StarcoderdataPython |
3463168 | #%%
H_d, H_c = get_hamiltonians(backend, subsystem_list, ['wq0'])
n_ctrls = len(H_c)
U_0 = identity(3)
U_targ = get_hadamard()
| StarcoderdataPython |
11244850 | <reponame>lorena112233/pythonDay1
#diccAbecedario = { "a":,"b","c","d","e","f","g","h","i","j","k","l","m","n","ñ","o","p","q","r","s","t","u","v","w","x","y","z" }
desplazamiento = 6
alfabeto = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".lower()
abecedario = {}
for letra in alfabeto:
posicion = alfabeto.index(letra)
nuevaP... | StarcoderdataPython |
1956672 | <reponame>aisthesis/opttrack<filename>opttrack/lib/utils.py
"""
Copyright (c) 2016 <NAME>
license http://opensource.org/licenses/MIT
lib/utils.py
General utility functions
"""
from __future__ import division
def safe_divide(numerator, denominator, default_answer=0.):
try:
return numerator / denominator
... | StarcoderdataPython |
198387 | <filename>CONUS/Winds/percentile_wind_vs_latitude_and_altitude.py
import iris.coord_categorisation
import matplotlib.style as style
from cf_units import Unit
import iris.quickplot as qplt
import iris.plot as iplt
import matplotlib.pyplot as plt
import iris.analysis as ia
import numpy as np
percentiles = [50, 75, 90, 9... | StarcoderdataPython |
4964282 | #!/usr/bin/env python
"""
This module is designed to used with _livereload to
make it a little easier to write Sphinx documentation.
Simply run the command::
python sphinx_server.py
and browse to http://localhost:5500
livereload_: https://pypi.python.org/pypi/livereload
"""
import os
from livereload import Ser... | StarcoderdataPython |
1742776 | import os
import sys
import cv2
import time
import logging
import json
import tensorflow as tf
import numpy as np
import glob
import tqdm
tf.compat.v1.disable_eager_execution()
sys.path.append(os.path.join(os.path.dirname(__file__), os.pardir))
import src
from src.data_manager import EmojifierDataManager
from src.__in... | StarcoderdataPython |
12833819 | <gh_stars>1-10
import json
import re
import xml.etree.ElementTree as ETree
from averell.utils import TEI_NAMESPACE as NS
from averell.utils import XML_NS
ECEP_NS = "{http://www.eighteenthcenturypoetry.org/ns}"
def get_poem_info(xml_file, lines_info, authors):
"""Poem parser for 'ECPA corpus'.
We read the da... | StarcoderdataPython |
6591179 | <gh_stars>0
import gym
import torch
from .base_classes import MuZeroConfigBase
from environment import PalleteWorld
import env_config as env_cfg
import numpy as np
class MuZeroConfig(MuZeroConfigBase):
def __init__(self):
super(MuZeroConfig, self).__init__()
self.seed = 0 # Seed for numpy, torch... | StarcoderdataPython |
6646852 | <reponame>zhangshen20/character-reverse<gh_stars>0
from .Character import Character | StarcoderdataPython |
14849 | """
This script is for testing/calling in several different ways
functions from QRColorChecker modules.
@author: <NAME>
@mail: <EMAIL>
"""
import unittest
import hashlib
import dateutil
from chalicelib.server import Server
import sys
import json
from datetime import datetime
sys.path.append('../chalicelib')
clas... | StarcoderdataPython |
4850587 | <gh_stars>0
import copy
import datetime
import json
import logging
import os
import statistics
from cluster_vcf_records import vcf_file_read
from minos import dependencies, genotyper, utils
from minos import __version__ as minos_version
class Error (Exception): pass
def _build_json_file_is_good(json_build_report):... | StarcoderdataPython |
8012345 | import os
import sys
from multiples_of_x_and_y import run
assert len(sys.argv) == 3, "please provide input_file_path and output_file_path"
input_file_path = sys.argv[1]
output_file_path = sys.argv[2]
assert os.path.isfile(input_file_path), "'{}' does not exist".format(input_file_path)
assert not os.path.isfile(output_... | StarcoderdataPython |
3427958 | <reponame>sodadata/soda-core
from __future__ import annotations
import pytest
from soda.execution.data_type import DataType
from tests.helpers.common_test_tables import (
customers_dist_check_test_table,
customers_profiling,
customers_test_table,
orders_test_table,
)
from tests.helpers.data_source_fixt... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.