id stringlengths 1 7 | text stringlengths 6 1.03M | dataset_id stringclasses 1
value |
|---|---|---|
161502 | from output.models.sun_data.elem_decl.type_def.type_def00203m.type_def00203m_xsd.type_def00203m import Root
__all__ = [
"Root",
]
| StarcoderdataPython |
188140 | <filename>mooncake_utils/file.py<gh_stars>1-10
# -*- coding:utf-8 -*-
# @author <NAME> ( <EMAIL> )
# @date 2017-06-07
import os
import glob
import shutil
def mkdirp(directory):
"""
利用python库来做到shell中的 ``mkdir -p``
好处是不用 ``os.system()``,避免了fork进程造成的资源浪费。
:param directory: 路径
"""
if not os.path.isdi... | StarcoderdataPython |
164987 | import pytest
from unittest.mock import MagicMock
@pytest.fixture(scope="function")
def canifier(ctre):
return ctre.CANifier(1)
@pytest.fixture(scope="function")
def cdata(canifier, hal_data):
return hal_data["CAN"][1]
def test_canifier_init(ctre, hal_data):
assert 1 not in hal_data["CAN"]
ctre.CA... | StarcoderdataPython |
66043 | import cv2
import numpy as np
# Capture the input frame
def get_frame(cap, scaling_factor=0.5):
ret, frame = cap.read()
# Resize the frame
frame = cv2.resize(frame, None, fx=scaling_factor,
fy=scaling_factor, interpolation=cv2.INTER_AREA)
return frame
if __name__=='__main__'... | StarcoderdataPython |
190507 | <reponame>planlodge/ChowNow-Theme-Wordpress<filename>tests/data/jacob/generate_remove_accents_tests.py
import unicodedata, codecs
# Generates testdata for the WordPress `remove_accents` function.
#
# Unicode defines character decompositions: e.g., an
# e with an umlaut (LATIN SMALL LETTER E WITH DIAERESIS) decomp... | StarcoderdataPython |
172683 | <reponame>vfdev-5/ignite-examples
from argparse import ArgumentParser
from pathlib import Path
from train import run
if __name__ == "__main__":
parser = ArgumentParser()
parser.add_argument("config_cv_folder", type=str,
help="Folder with configuration files")
args = parser.parse_a... | StarcoderdataPython |
3327552 | from django.contrib import admin
# Register your models here.
from detection.models import File
admin.site.register(File) | StarcoderdataPython |
1605286 | <gh_stars>0
import shelve
import re
import json
import threading
import traceback
import os
from collections import defaultdict
import subprocess
try:
from subprocess import DEVNULL #pylint: disable=no-name-in-module
except:
DEVNULL = open(os.devnull, "r+b")
from .common import * #pylint: disable=wildcard-i... | StarcoderdataPython |
3229411 | from argparse import ArgumentParser
from config_parser import get_config
from utils.loss import LabelSmoothingLoss
from utils.opt import get_optimizer
from utils.scheduler import WarmUpLR, get_scheduler
from utils.trainer import train, evaluate
from utils.dataset import get_loader
from utils.misc import seed_everythin... | StarcoderdataPython |
4826492 | <filename>postgresqleu/confsponsor/migrations/0009_vat_allow_null.py
# -*- coding: utf-8 -*-
# Generated by Django 1.11.10 on 2018-06-27 12:54
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('confsponsor', '0008_cl... | StarcoderdataPython |
140705 | from __future__ import annotations
import io
import tempfile
import typing
import contextlib
import apicall.config as config
import apicall.arguments as arg
class StartCondition(typing.NamedTuple):
""" コマンドの実行開始時の条件 """
args: typing.List[str]
config: typing.Optional[config.Config]
def parse(self) -> ... | StarcoderdataPython |
3237463 | <filename>sa/profiles/Juniper/JUNOS/get_arp.py
# ---------------------------------------------------------------------
# Juniper.JUNOS.get_arp
# ---------------------------------------------------------------------
# Copyright (C) 2007-2016 The NOC Project
# See LICENSE for details
# -----------------------------------... | StarcoderdataPython |
57661 | <gh_stars>1-10
#!/usr/bin/env python
import json
from auth0_client.Auth0Client import Auth0Client
from auth0_client.menu.menu_helper.common import *
from auth0_client.menu.menu_helper.pretty import *
try:
enrollments = {}
client = Auth0Client(auth_config())
types = ['totp','sms','push','email','recov... | StarcoderdataPython |
3221086 | <reponame>jonohart/voltha
#!/usr/bin/env python
"""
A simple process to read time-series samples from a kafka topic and shove
the data into graphite/carbon as pickled input.
The code is based on a github/gist by phobos182
(https://gist.github.com/phobos182/3931936).
As all GitHib gists, it is covered by the MIT lice... | StarcoderdataPython |
195703 | from symplyphysics import (
symbols, Eq, pretty, solve, Quantity, units,
validate_input, validate_output, expr_to_quantity
)
from symplyphysics.laws.thermodynamics import pressure_from_temperature_and_volume as thermodynamics_law
# Description
## Boyle's law (Isothermal process): T = const, P1 * V1 = P2 * V2
#... | StarcoderdataPython |
1725630 | #!/usr/bin/python
# coding=utf-8
import urllib2
import urllib
import json
import HTMLParser
import re
import alfred
################################################################################
def strip_html( html ):
p = re.compile( r"<.*?>" )
return p.sub( "", html )
def unescape_html( html ):
html_... | StarcoderdataPython |
1626592 | <filename>testslide/cli.py<gh_stars>0
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import argparse
import os
import re
import sys
import unittest
from contextlib import contextmanager
fro... | StarcoderdataPython |
152943 | <filename>codes/utils/evaluate.py
# Evaluate a saved model with respect to testing data
import torch
from torch.autograd import Variable
import numpy as np
import json
import pandas as pd
import argparse
from codes.models import decoders
from codes.utils import data as data_utils
from codes.utils import constants
impor... | StarcoderdataPython |
3326850 | # --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
import os... | StarcoderdataPython |
3391306 | import copy
from misc import *
from path import *
from draw import *
from mode import Mode
from knob import DraggableKnob
from nanogui import *
class SpecularManifoldSamplingMode(Mode):
def __init__(self, viewer):
super().__init__(viewer)
self.seed_path = None
self.solution_path = None
... | StarcoderdataPython |
1605915 | # Copyright 2011 <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 License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | StarcoderdataPython |
4807642 | <reponame>tonghs/web-template<filename>utils/crypto.py
import hashlib
import hmac
from typing import Dict, List
from config import API_SECRET
def _dict_to_str(data: Dict):
keys: List[str] = list(data.keys())
params: List[str] = []
for key in sorted(keys):
if key == 'sign':
continue
... | StarcoderdataPython |
173920 | <reponame>cmu-catalyst/collage
import argparse
import tensorflow as tf
import numpy as np
import time
from shared_functions import make_matmul
def attention(input, heads):
d_model = input.shape[1].value
q = make_matmul(input, d_model)
k = make_matmul(input, d_model)
v = make_matmul(input, d_model)
... | StarcoderdataPython |
1603257 | from robot.trajectory import quintic_trajectory_planning
from tools.visualize import plot_joint_trajectory
import numpy as np
if __name__ == "__main__":
q0 = np.array([-2, -1, 0, 1, 2, 3])
qd0 = np.array([0, 0, 0, 0, 0, 0])
qdd0 = np.array([0, 0, 0, 0, 0, 0])
qf = np.array([4, -3, -2, 0, 4, -2])
qd... | StarcoderdataPython |
53481 | <reponame>Luigimonbymus/Modern-Quest<filename>Item.py
class item():
def ___init___(self, name, desc, worth):
self.name=name
self.desc=desc
self.worth=worth
def _str_(self):
return "{}\n=====\n{}\nWorth: {}\n".format(self.name, self.desc, self.worth)
class money(item):
def __... | StarcoderdataPython |
194175 | import atexit
import collections
import datetime
import functools
import logging
import os
import re
import textwrap
from dataclasses import dataclass
from typing import Any, Dict, Iterable, List, Optional, Set, Tuple, Union
from unittest.mock import patch
# This import verifies that the dependencies are available.
im... | StarcoderdataPython |
74437 | <reponame>Zylphrex/friendly-octo-meme
# -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2017-01-22 00:23
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('faver_app', '0003_contract'),
]
operations = [
... | StarcoderdataPython |
1786381 | # 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/licenses/LICENSE-2.0
#
# Unless required by applica... | StarcoderdataPython |
148885 | <gh_stars>1-10
import datetime
import os
import shutil
import time
import tarfile
import yaml
from uuid import uuid1
import pytest
import requests
def pytest_addoption(parser):
parser.addoption('--host', help='Tator host', default='https://adamant.duckdns.org')
parser.addoption('--token', help='API token', de... | StarcoderdataPython |
3249136 | <reponame>JavierLuna/intcode
from typing import List
import pytest
from intcode.interpreter.state import MachineState, AccessMode
@pytest.fixture
def mocked_program() -> List[int]:
return [1, 2, 3]
@pytest.fixture
def mocked_machine_state(mocked_program) -> MachineState:
return MachineState(mocked_program... | StarcoderdataPython |
1627336 | import re
from typing import Dict, Union, Iterable, Any
from ._BaseClasses import DOMNode
POSSIBLE_TAG_CHILD = Union[str, int, float, DOMNode]
def maketag(name: str) -> type:
"""
Creates a new class for a tag with the specified name.
The class can be used like those associated with standard HTML tags :
"""
tag... | StarcoderdataPython |
3398449 | import torch
import torch.nn as nn
import torch.nn.functional as F
'''
NST with Polynomial Kernel, where d=2 and c=0
It can be treated as matching the Gram matrix of two vectorized feature map.
'''
class NST(nn.Module):
def __init__(self):
super(NST, self).__init__()
def forward(self, g_s, g_t):
#return [self.n... | StarcoderdataPython |
1759613 | from src.easy import search_insert_position_35
def test_search_insert_position():
s = search_insert_position_35.Solution()
assert s.search_insert_position([1,3,5,6], 7) == 4
assert s.search_insert_position([1,3,5,6], 5) == 2
assert s.search_insert_position([1,3,5,6], 4) == 2
assert s.search_insert... | StarcoderdataPython |
185342 | <gh_stars>0
from django.apps import AppConfig
from django.utils.translation import gettext_lazy as _
class FoodProcessingConfig(AppConfig):
name = 'scieio.food_processing'
verbose_name = _("Food Processing Equipment")
| StarcoderdataPython |
163552 | <reponame>RickyMexx/SAC-tf2
from common.utils import *
class Agent:
def __init__(self, model, replay_buffer, train_env, test_env, replay_start_size,
n_episodes, batch_size, n_actions):
self.model = model
self.replay_buffer = replay_buffer
self.train_env = train_env
... | StarcoderdataPython |
163980 | <filename>revs/util.py
class Util:
def __init__(self):
pass
@staticmethod
def compress_uri(uri, base_uri, prefix_map):
uri = uri.strip('<>')
if uri.startswith(base_uri):
return '<' + uri[len(base_uri):] + '>'
for prefix, prefix_uri in prefix_map.items():
... | StarcoderdataPython |
3273991 | <gh_stars>0
from django.apps import AppConfig
class Config(AppConfig):
name = "grandchallenge.cases"
def ready(self):
super().ready()
# noinspection PyUnresolvedReferences
import grandchallenge.cases.signals
| StarcoderdataPython |
3264111 | # =====================================
# generator=datazen
# hash=28f11439ad9a52693ca50830cd17d838
# =====================================
"""
example - description
"""
JSON = "json"
YAML = "yaml"
# quote these because jinja generates with single-quotes and black wants to
# re-format to double-quotes
TOP_LIST = "['... | StarcoderdataPython |
4834179 | #!/usr/bin/env python
import glob
import sys
import os
from slackviewer.main import main as slackviewer
import boto3
import botocore
# Get latest backup zip file from s3
s3 = boto3.resource('s3')
bucket_name = os.environ['BUCKET_NAME']
backup_filename = 'backup.zip'
filenames = []
for objects in s3.Bucket(bucket_nam... | StarcoderdataPython |
3363597 | <gh_stars>1-10
import FWCore.ParameterSet.Config as cms
from ..modules.hltPreEle5WP70OpenUnseeded_cfi import *
from ..sequences.HLTBeginSequence_cfi import *
from ..sequences.HLTEle5WP70OpenUnseededSequence_cfi import *
from ..sequences.HLTEndSequence_cfi import *
MC_Ele5_WP70_Open_Unseeded = cms.Path(
HLTBeginSe... | StarcoderdataPython |
1775579 | import unittest
from .isomorphic_strings import Solution
class Test(unittest.TestCase):
@classmethod
def setUpClass(cls) -> None:
cls.sol = Solution()
def test_example1(self):
self.assertEqual(self.sol.isIsomorphic("egg", "add"), True)
def test_example2(self):
self.assertEqua... | StarcoderdataPython |
1742113 | <filename>site_checker/storage/redis_backend.py
from datetime import timedelta
import json
from typing import Union
import redis
from site_checker.storage.base import AbstractStorage
class RedisStorage(AbstractStorage):
def __init__(self, redis_config=None, expire_in_minutes=30, *args, **kwargs):
"""
... | StarcoderdataPython |
1742634 | import asyncio
from unittest import mock
import pytest
from waterbutler.core import utils
class TestAsyncRetry:
@pytest.mark.asyncio
async def test_returns_success(self):
mock_func = mock.Mock(return_value='Foo')
retryable = utils.async_retry(5, 0, raven=None)(mock_func)
x = await r... | StarcoderdataPython |
129613 | <reponame>maxtaylordavies/BigGAN-PyTorch<filename>datasets.py
''' Datasets
This file contains definitions for our CIFAR, ImageFolder, and HDF5 datasets
'''
import os
import os.path
import sys
from PIL import Image
import numpy as np
from tqdm import tqdm, trange
import h5py as h5
import torch
import torc... | StarcoderdataPython |
1673360 | <reponame>enosteteo/Introducao-a-Programacao-P1<filename>4. Estrutura de Repeticao While/Lista 02/programa 02.py
cont = 25
qtdeParEPositivo = 0
while cont > 0:
numero = int(input())
if (numero >= 0) and (numero % 2 == 0):
qtdeParEPositivo += 1
cont -= 1
print(qtdeParEPositivo)
| StarcoderdataPython |
3288827 | from .Address import Address
from .Authorization import Authorization
from .Avatar import Avatar
from .BankAccount import BankAccount
from .Contract import Contract
from .DigitalAssetAddress import DigitalAssetAddress
from .EmailAddress import EmailAddress
from .Error import Error
from .JoinOrganizationInvitation impor... | StarcoderdataPython |
1676570 | <reponame>vbilyi/prometheus_toolbox<gh_stars>0
from .measures import *
| StarcoderdataPython |
1622402 | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import odoo
import odoo.tests
@odoo.tests.common.tagged('post_install', '-at_install', 'website_snippets')
class TestSnippets(odoo.tests.HttpCase):
def test_01_empty_parents_autoremove(self):
self.start_to... | StarcoderdataPython |
3395685 | <reponame>c-cube/mc2
#!/usr/bin/python
import subprocess, sys
filename: str = sys.argv[1]
z3_out = subprocess.run([b'z3', filename], capture_output=True).stdout
if z3_out != b'unsat\n':
sys.exit(0)
b_out = subprocess.run([b'./mc2.exe', filename], capture_output=True).stdout
if b_out.startswith(b'Sat') and b'Err... | StarcoderdataPython |
3385161 | <gh_stars>10-100
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import time
import numpy as np
import tensorflow as tf
import os
import random
import copy
from tensorflow.python.util import nest
from config import *
import os
import sys
dir_path = os.pat... | StarcoderdataPython |
3270417 | <reponame>hbasria/py-registry
import inspect
from dictutils import OrderedAttrDict
class Registry(OrderedAttrDict):
def register_decorator(self, **kwargs):
name = kwargs.get("name")
def decorator(decorated):
self.register_func(data=decorated, name=name)
return decorated
... | StarcoderdataPython |
1672915 | from glob import glob
def get_activations(model, model_inputs, print_shape_only=False, layer_name=None):
import keras.backend as K
print('----- activations -----')
activations = []
inp = model.input
model_multi_inputs_cond = True
if not isinstance(inp, list):
# only one input! let's w... | StarcoderdataPython |
1654905 | #!/usr/bin/env python
"""
This example shows how to create shipments. The variables populated below
represents the minimum required values. You will need to fill all of these, or
risk seeing a SchemaValidationError exception thrown.
Near the bottom of the module, you'll see some different ways to handle the
label data... | StarcoderdataPython |
54268 | from .video_utils import VideoClips
from .utils import list_dir
from .folder import make_dataset
from .vision import VisionDataset
class KineticsVideo(VisionDataset):
def __init__(self, root, frames_per_clip, step_between_clips=1):
super(KineticsVideo, self).__init__(root)
extensions = ('avi',)
... | StarcoderdataPython |
3264243 | #%% Packages and functions
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from lib.functions import *
import seaborn as sns; sns.set()
from datetime import datetime
#%%##################################################################################################
# input parameters
article_n... | StarcoderdataPython |
23450 | <reponame>RiboswitchClassifier/RiboswitchClassification<gh_stars>1-10
from sklearn.model_selection import cross_val_score, GridSearchCV, cross_validate, train_test_split
from sklearn.metrics import accuracy_score, classification_report
from sklearn.neural_network import MLPClassifier
import pandas as pd
import csv
fro... | StarcoderdataPython |
175762 | def accumulate():
pass
| StarcoderdataPython |
3257790 | import logging
import pickle
from pathlib import Path
import cv2
import numpy as np
import pandas as pd
from tqdm import tqdm
from sklearn.cluster import DBSCAN
from config import OUTPUT_FILE, OUTPUT_LABEL_FOLDERS
from src.utils import read_image
logging.info("Loading encodings")
data = pickle.loads(open(OUTPUT_FILE... | StarcoderdataPython |
171207 | from pyabc import ABCSMC, Distribution
from pyabc.sampler import MulticoreEvalParallelSampler, SingleCoreSampler
import scipy.stats as st
import numpy as np
from datetime import datetime, timedelta
set_acc_rate = 0.2
pop_size = 10
def model(x):
"""Some model"""
return {"par": x["par"] + np.random.randn()}
... | StarcoderdataPython |
161070 | <gh_stars>0
# Implementation of classic arcade game Pong
import simplegui
import random
# initialize globals - pos and vel encode vertical info for paddles
WIDTH = 600
HEIGHT = 400
BALL_RADIUS = 15
PAD_WIDTH = 8
PAD_HEIGHT = 80
HALF_PAD_WIDTH = PAD_WIDTH / 2
HALF_PAD_HEIGHT = PAD_HEIGHT / 2
LEFT = False
RIGHT ... | StarcoderdataPython |
1647175 | <filename>research/DailyPriceInfo/trend_analysis_utils.py
trend_type = ['three_day_up', '5_perc_up', '3_perc_up', '1_perc_up',\
'three_day_down', '5_perc_down', '3_perc_down', '1_perc_down', \
'1_perc_var', 'NA']
def get_trend_type(close_price):
if (len(close_price) >= 4):
if ... | StarcoderdataPython |
2342 | import sys
import os
from tempfile import TemporaryDirectory
import numpy as np
import tensorflow.compat.v1 as tf
tf.get_logger().setLevel('ERROR') # only show error messages
from recommenders.utils.timer import Timer
from recommenders.utils.constants import SEED
from recommenders.models.deeprec.deeprec_utils import ... | StarcoderdataPython |
1677200 | <reponame>nathanael-fijalkow/DeepSynth
import logging
import time
import random
import csv
import matplotlib.pyplot as plt
import numpy as np
from math import log10
from type_system import Type, PolymorphicType, PrimitiveType, Arrow, List, UnknownType, INT, BOOL
from program import Program, Function, Variable, BasicPr... | StarcoderdataPython |
59576 | <reponame>WadeBarnes/von-bc-registries-audit
#!/usr/bin/python
import os
import psycopg2
import datetime
import time
import json
import decimal
import requests
import csv
from config import get_connection, get_db_sql, get_sql_record_count, CORP_TYPES_IN_SCOPE, corp_num_with_prefix, bare_corp_num
QUERY_LIMIT = '2000... | StarcoderdataPython |
75983 | <gh_stars>10-100
#!/usr/bin/env python
import os
import sys
import argparse
import re
import imctools.io.mcdparser as mcdparser
import imctools.io.txtparser as txtparser
import imctools.io.ometiffparser as omeparser
import imctools.io.mcdxmlparser as meta
############################################
################... | StarcoderdataPython |
3375015 | # -*- coding:utf-8 -*-
import logging
logger = logging.getLogger(__name__)
import ast
import re
import os.path
import tempfile
import shutil
import hashlib
import stat
from prestring.python import PythonModule
from functools import partial
from collections import namedtuple
from io import StringIO
from kamo.expr import... | StarcoderdataPython |
30739 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2016 Red Hat, Inc
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless req... | StarcoderdataPython |
1679173 | <filename>app/api/track/service/merging.py
from typing import Union, Optional
from tracardi.domain.profile import Profiles, Profile
from tracardi.service.storage.driver import storage
async def merge(profile: Optional[Profile], limit=2000) -> Union[Profiles, None]:
# Merging, schedule save only if there is an upd... | StarcoderdataPython |
3364496 | import komand
from .schema import GetAuthenticationSourceInput, GetAuthenticationSourceOutput
# Custom imports below
from komand_rapid7_insightvm.util import endpoints
from komand_rapid7_insightvm.util.resource_requests import ResourceRequests
class GetAuthenticationSource(komand.Action):
def __init__(self):
... | StarcoderdataPython |
17466 | """Exceptions for Renault API."""
class RenaultException(Exception): # noqa: N818
"""Base exception for Renault API errors."""
pass
class NotAuthenticatedException(RenaultException): # noqa: N818
"""You are not authenticated, or authentication has expired."""
pass
| StarcoderdataPython |
1718969 | <reponame>mattmurch/furl
# -*- coding: utf-8 -*-
#
# furl - URL manipulation made simple.
#
# <NAME>
# grunseid.com
# <EMAIL>
#
# License: Build Amazing Things (Unlicense)
#
from .compat import string_types
absent = object()
def callable_attr(obj, attr):
return hasattr(obj, attr) and callable(getattr(obj, att... | StarcoderdataPython |
3354353 | <reponame>cwandtj/A2P2
import glob, re, os, operator, itertools, copy, collections
from math import sin, cos, acos,radians
import parser
import our_module
import ast
import sys
# change runjob.sh
#our_module.change_vasp_path()
open('compound_directories', 'w').close()
# we choose files to work on depending on argumen... | StarcoderdataPython |
40212 | <reponame>viebboy/PyGOP
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Author: <NAME>
Email: <EMAIL>, <EMAIL>
github: https://github.com/viebboy
"""
from . import gop_utils
from . import gop_operators
from . import misc
| StarcoderdataPython |
1638461 | <reponame>FelixTheC/onlineOrderForm
from django import forms
from .models import OrderContactDeliveryAddresse
from .models import OrderContactInvoiceAddresse
class InvoiceAddresseForm(forms.ModelForm):
class Meta:
model = OrderContactInvoiceAddresse
fields = '__all__'
labels = {
... | StarcoderdataPython |
166523 | <filename>spotilyzer/subcommands/csv/requests.py<gh_stars>0
"""
spotilyzer requests CSV
"""
# system imports
import csv
# project imports
from ..json.requests import REQUESTS_KEY, POD_NAME_KEY, REPLICAS_KEY, \
CORE_LIMIT_KEY, MEM_LIMIT_KEY
# constants
_types = (str, int, float, float)
def load_requests(freques... | StarcoderdataPython |
3245740 | import os
import json
import time
import codecs
import plistlib
import subprocess
import lyrebird
from lyrebird import context
from lyrebird.log import get_logger
from . import wda_helper
from pathlib import Path
_log = get_logger()
ideviceinstaller = None
idevice_id = None
idevicescreenshot = None
ideviceinfo = None... | StarcoderdataPython |
1641264 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
if __name__ == '__main__':
m = int
x = int(input("Value of x? "))
if x < 50:
m = 30*x
elif x in range(50, 75):
m = 50*x
elif x in range(75, 90):
m = 65*x
else:
m = (70*x)+20
print(m)
exit(1)
| StarcoderdataPython |
1787551 | import openmdao.api as om
from turboshaft_generator_comp import TurboshaftGenerator
from propulsion_assembly_comp import PropulsionAssembly
class PropulsionGroupODE(om.Group):
def initialize(self):
self.options.declare('num_nodes', types=int, default = 1,
desc='Number of no... | StarcoderdataPython |
52318 | #!/usr/bin/env python
#=========================================================================
# This is OPEN SOURCE SOFTWARE governed by the Gnu General Public
# License (GPL) version 3, as described at www.opensource.org.
# Copyright (C)2021 <NAME> <<EMAIL>>
#========================================================... | StarcoderdataPython |
174007 | <filename>test/ResultsAndPrizes/matchball/test_matchball_results_of_the_draw_date_current_date.py
# matchball + Результаты тиража по дате + текущая дата
def test_matchball_results_draw_date_current_date(app):
app.ResultAndPrizes.open_page_results_and_prizes()
app.ResultAndPrizes.click_game_matchball()
ap... | StarcoderdataPython |
3235816 | <filename>userbot/modules/allunban.py
# Port By @VckyouuBitch From GeezProjects
# Copyright © 2021 Geez-Projects
from telethon.tl.types import (
ChannelParticipantsKicked,
)
from userbot import CMD_HELP, CMD_HANDLER as cmd
from userbot.utils import flicks_cmd
@flicks_cmd(pattern="allunban(?:\\s|$)([\\s\\S]*)")
a... | StarcoderdataPython |
3380482 | import numpy as np
from sklearn import tree
from IPython.display import Image
import pydotplus
data = np.loadtxt('spambase/q1.txt', dtype=str, delimiter=',')
np.place(data[:, 0], data[:, 0] == 'h', [0])
np.place(data[:, 0], data[:, 0] == 'c', [1])
np.place(data[:, 1], data[:, 1] == 'm', [0])
np.place(data[:, 1], data[... | StarcoderdataPython |
3248999 | #
# normal_surfaces.py
#
from file_io import parse_data_file
from taut import isosig_to_tri_angle
import regina
def count_quads(surf):
count = 0
for i in range(surf.triangulation().countTetrahedra()):
for j in range(3):
count += surf.quads(i, j)
return count
def count_quad_types(surf)... | StarcoderdataPython |
1651336 | <reponame>boringlee24/keras_old<filename>examples/pwr_run/checkpointing/throughput/comparison/compare_final2_inverse/generate_csv.py
import glob
import json
import pdb
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import csv
with open('k80_only_JCT.json', 'r') as fp:
k80_only = json.load(fp)... | StarcoderdataPython |
81377 | # https://docs.aws.amazon.com/code-samples/latest/catalog/python-secretsmanager-secrets_manager.py.html
import boto3
from abc import ABC
import logging
import json
class SecretsManager(ABC):
def __init__(self, secret_id: str):
self._secret_id = secret_id
self._logger = logging.getLogger(SecretsMan... | StarcoderdataPython |
3320413 | <reponame>seebees/aws-encryption-sdk-python
# Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the License. A copy of
# the License is located at
#
# http://aws.amazon.com/apa... | StarcoderdataPython |
1687868 | from application.caches.cache import Cache
from google.appengine.api import memcache
class GoogleMemcache(Cache):
def __init__(self):
pass
def add(self, key, value):
return memcache.add(key, value)
def get(self, key):
return memcache.get(key)
| StarcoderdataPython |
3340500 | <reponame>doggy8088/azure-devops-cli-extension
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# ---------------------... | StarcoderdataPython |
44147 | <filename>Megatron-LM-v1.1.5-3D_parallelism/megatron/configs/realm.py
# network size
ict_head_size = None
# checkpointing
ict_load = None
bert_load = None
# data
titles_data_path = None
query_in_block_prob = 0.1
use_one_sent_docs = False
# training
report_topk_accuracies = []
# faiss index
faiss_use_gpu = False
bl... | StarcoderdataPython |
1750156 | from rest_framework import generics, permissions, views, status
from rest_framework.response import Response
from .models import Course, Group, Code
from .serializers import CourseSerializer, GroupSerializer, CodeSerializer
from users.models import User
class CourseListView(generics.ListAPIView):
permission_clas... | StarcoderdataPython |
40963 | <reponame>Rhadow/leetcode
class Solution:
# @param num : a list of integer
# @return : a list of integer
def nextPermutation(self, num):
# write your code here
# Version 1
bp = -1
for i in range(len(num) - 1):
if (num[i] < num[i + 1]):
bp = i
... | StarcoderdataPython |
3253331 | <reponame>CyberFlameGO/macropy<gh_stars>1000+
import macropy.core
import macropy.core.macros
macros = macropy.core.macros.Macros()
@macros.block
def my_macro(tree, target, **kw):
assert macropy.core.unparse(target) == "y"
assert macropy.core.unparse(tree).strip() == "x = (x + 1)", macropy.core.unparse(tree)
... | StarcoderdataPython |
3275140 | """Tests dla distutils.command.bdist_wininst."""
zaimportuj unittest
z test.support zaimportuj run_unittest
z distutils.command.bdist_wininst zaimportuj bdist_wininst
z distutils.tests zaimportuj support
klasa BuildWinInstTestCase(support.TempdirManager,
support.LoggingSilencer,
... | StarcoderdataPython |
1612236 | # -*- coding: utf-8 -*-
# Scrapy settings for bankcrawler project
#
# For simplicity, this file contains only settings considered important or
# commonly used. You can find more settings consulting the documentation:
#
# https://docs.scrapy.org/en/latest/topics/settings.html
# https://docs.scrapy.org/en/latest/... | StarcoderdataPython |
1795002 | <gh_stars>10-100
#!/usr/bin/env python
#
# Copyright (C) 2011, 2012, 2013 Google Inc.
#
# This file is part of YouCompleteMe.
#
# YouCompleteMe is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3... | StarcoderdataPython |
66633 | def query(self, sql, *args):
'''Mixin method for the XXXBase class.
conn should be a cm.db.Connection instance.'''
conn = self._get_connection()
return conn.query(sql, *args)
def get_connection(self):
'''Mixin method for the XXXBase class.
Returns a cm.db.Connection instance.'''
raise 'No i... | StarcoderdataPython |
4830977 | <reponame>lrei/text-classification
#!/usr/bin/env python
"""Merge text predictions into dev and test sets."""
import argparse
import pandas as pd
def parse_args():
parser = argparse.ArgumentParser(
description="merge predictions into dataset files"
)
parser.add_argument(
"--dataset", typ... | StarcoderdataPython |
3261213 | <gh_stars>0
import numpy as np
from ..base import BaseEstimator
from typing import Callable, NoReturn
class AdaBoost(BaseEstimator):
"""
AdaBoost class for boosting a specified weak learner
Attributes
----------
self.wl_: Callable[[], BaseEstimator]
Callable for obtaining an instance of t... | StarcoderdataPython |
3388526 | import numpy as np
import math
import sys
import pickle
def Coord2Pixels(lat, lon, min_lat, min_lon, max_lat, max_lon, sizex, sizey):
#print(max_lat, min_lat, sizex)
ilat = sizex - int((lat-min_lat) / ((max_lat - min_lat)/sizex))
#ilat = int((lat-min_lat) / ((max_lat - min_lat)/sizex))
ilon = int((lon... | StarcoderdataPython |
1635557 | #Code By <NAME> (aadiupadhyay)
from sys import stdin,stdout
#Fast input output
st=lambda:list(stdin.readline().strip())
li=lambda:list(map(int,stdin.readline().split()))
mp=lambda:map(int,stdin.readline().split())
inp=lambda:int(stdin.readline())
pr=lambda n: stdout.write(str(n)+"\n")
mod=1000000007
def solve():
... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.