id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
1860298 | <filename>rlpy/domains/domain.py
"""Domain base class"""
from abc import ABC, abstractmethod
from copy import deepcopy
import logging
import numpy as np
__copyright__ = "Copyright 2013, RLPy http://acl.mit.edu/RLPy"
__credits__ = [
"<NAME>",
"<NAME>",
"<NAME>",
"<NAME>",
"<NAME>",
]
__license__ = "... | StarcoderdataPython |
3540403 | from math import ceil
n, m = map(int, input().split())
a = list(map(int, input().split()))
a.append(n + 1)
a.append(0)
a.sort()
d = []
md = n
for i in range(m + 1):
d_ = a[i + 1] - a[i] - 1
d.append(d_)
if d_ == 0:
continue
md = min(md, d_)
c = 0
for i in d:
c += ceil((i) / md)
print(c)
| StarcoderdataPython |
6433715 | <filename>cafeteria/patterns/borg.py<gh_stars>1-10
class BorgStateManager(object):
"""
A special State Manager for Borg classes and child classes. This is what
makes it possible for child classes to maintain their own state different
to both parents, siblings and their own children.
This itself imp... | StarcoderdataPython |
8182392 | """
iTunes App Store Scraper
"""
import requests
import json
import time
import re
from datetime import datetime
from urllib.parse import quote_plus
from itunes_app_scraper.util import AppStoreException, AppStoreCollections, AppStoreCategories, AppStoreMarkets
class Regex:
STARS = re.compile("<span class=\"total\... | StarcoderdataPython |
11321828 | <reponame>bjk7119/fosslight_binary_scanner
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2020 LG Electronics Inc.
# SPDX-License-Identifier: Apache-2.0
from fosslight_util.help import PrintHelpMsg
_HELP_MESSAGE_BINARY = """
Usage: fosslight_bin [option1] <arg1> [option2] <arg2>...
After extrac... | StarcoderdataPython |
6615183 | #!/usr/bin/env python3
#
# Copyright 2019 The Bazel 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 ... | StarcoderdataPython |
9626523 | from pynput import keyboard as kb
import string as s
from PIL import Image, ImageGrab
import random
import os
# Format RGB to Hex
def rgb2hex(r,g,b):
return '#{:02x}{:02x}{:02x}'.format(r,g,b).upper()
# Grabs image from clipboard and outputs colour from pixels.
def clip2png():
i = ImageGrab.grabclipboard()
... | StarcoderdataPython |
5180154 | <filename>ghub/services/tests/test_drf_views.py
import pytest
from django.test import RequestFactory
from ghub.services.api.views import ServiceViewSet
from ghub.services.models import Service
pytestmark = pytest.mark.django_db
class TestServiceViewSet:
def test_get_queryset(self, service: Service, rf: RequestF... | StarcoderdataPython |
11257145 | <reponame>faweigend/pypermod
from pypermod.agents.cp_agent_basis import CpAgentBasis
class CpODEAgentBasisLinear(CpAgentBasis):
"""
This class defines the structure for all differential agents.
Provided are functions for dynamic power outputs and commands for simulations.
Differential agents allow rea... | StarcoderdataPython |
59675 | <reponame>sourcery-ai-bot/factom-core<filename>factom_core/blocks/admin_block.py
import hashlib
from dataclasses import dataclass, field
from typing import List
from factom_core.block_elements.admin_messages import *
from factom_core.utils import varint
from .directory_block import DirectoryBlock
@dataclass
class Ad... | StarcoderdataPython |
6425235 | <reponame>PacktPublishing/Designing-Models-for-Responsible-AI<gh_stars>0
import numpy as np
from ..core import BaseServer
class FedAvgServer(BaseServer):
def __init__(self, clients, global_model, server_id=0):
super().__init__(clients, global_model, server_id=server_id)
def update(self, weight=None)... | StarcoderdataPython |
11321217 | import torch
import torch.nn as nn
from tools import get_kappa
def train_model(model, device, lr, epochs, train_dataloader, valid_dataloader = None, logger = None):
optimizer = torch.optim.Adam(model.parameters(), lr = lr)
criterion = nn.MSELoss()
best_loss = 1e15
for ep in range(epochs):
# tr... | StarcoderdataPython |
3562916 | # AUTOGENERATED! DO NOT EDIT! File to edit: annotation_viewer.ipynb (unless otherwise specified).
__all__ = ['WINDOW_NAME', 'ANNOTATION_COLOR', 'ImageLoader', 'show_annotated_images', 'configure_logging']
# Cell
import sys
import argparse
import logging
import cv2
import math
import numpy as np
import aiforce.image.... | StarcoderdataPython |
1712046 | <gh_stars>1-10
"""
A catch-all file that imports the whole framework.
:file: __init__.py
:date: 27/08/2015
:authors:
- <NAME> <<EMAIL>>
"""
# Core classes.
from .base import *
from .struct import *
# Serializers
from .scalars import *
from .enum import *
# Misc.
from .validators import *
| StarcoderdataPython |
373963 | def tflm_kernel_friends():
return []
def tflm_audio_frontend_friends():
return []
def xtensa_fusion_f1_cpu():
return "F1_190305_swupgrade"
def xtensa_hifi_3z_cpu():
return "HIFI_190304_swupgrade"
def xtensa_hifi_5_cpu():
return "AE_HiFi5_LE5_AO_FP_XC"
| StarcoderdataPython |
11236765 | <filename>svm/dnase/IMR90/svm_predictions_svmtrainset_genometestset/make_bed_from_hdf.py
import sys
fold=sys.argv[1]
import pandas as pd
data=pd.read_hdf("IMR90."+str(fold)+".classification.withgc.dl.pred.svmtrainset.genometestset.hdf5.labels.0")
data.to_csv("labels."+str(fold)+".bed",sep='\t',index=True,header=False)
| StarcoderdataPython |
6602746 | <gh_stars>0
# search.py
# ---------
# Licensing Information: You are free to use or extend these projects for
# educational purposes provided that (1) you do not distribute or publish
# solutions, (2) you retain this notice, and (3) you provide clear
# attribution to UC Berkeley, including a link to http://ai.berkeley... | StarcoderdataPython |
11284542 | <gh_stars>1-10
import sys
import asyncio
import logging
import disnake
from disnake.ext import commands
from . import checks, interactions, error_handler, types, utils
from .config import Config
assert sys.version_info[:2] >= (3, 9)
# required for aiodns on windows
if sys.platform == 'win32':
asyncio.set_event_... | StarcoderdataPython |
9797236 | <gh_stars>0
from sklearn.ensemble import VotingClassifier
from sklearn.svm import SVC
from sklearn.ensemble import GradientBoostingClassifier
from sklearn.neural_network import MLPClassifier
from src.models.vanilla_classifier import VanillaClassifier
class Bagging(VanillaClassifier):
"""
Bagging Classifier
... | StarcoderdataPython |
3558786 | <gh_stars>1-10
#!/usr/bin/env python3
# # -*- coding: utf-8 -*-
"""
The launcher command available when running the CLI.
Responsible for creating launcher commands.
________________________________________________________________________________
Created by brightSPARK Labs
www.brightsparklabs.com
"""
# standard lib... | StarcoderdataPython |
237683 | <reponame>yangruihan/excel_parser
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
import sys
import xlrd
LOOP_TYPE_KEYS = ['repeated']
STRUCT_TYPE_KEYS = ['required_struct', 'optional_struct']
class ExcelParser:
"""
Excel 解析器
"""
def parse_all_sheet(self, excel_path: str) -> list:
"""
... | StarcoderdataPython |
4941668 | <reponame>terrorizer1980/Dashboard-api
from tests import tools
from tests.tools import CLIENT_URL
from Utils.Responses import bad_oauth_response
noauth_client = tools.generate_noauth_client()
def test_oauth_redir():
resp = noauth_client.request("GET", "/api/discord/login", allow_redirects=False)
#... | StarcoderdataPython |
1862882 | <gh_stars>0
from .config import get_config
from .libs.auth import jwt, oauth, register_providers
from .libs.cache import cache
from .models import models # noqa: F401
from .models.common.db import db
from .resources import (
AuditAPI,
HealthCheckAPI,
LoginAPI,
RegisterAPI,
UserAPI,
OAuthLoginAP... | StarcoderdataPython |
13541 | __author__ = "<NAME>"
__copyright__ = "Copyright 2015-2019, <NAME>"
__email__ = "<EMAIL>"
__license__ = "MIT"
import os
import shutil
import signal
import marshal
import pickle
import json
import time
from base64 import urlsafe_b64encode, b64encode
from functools import lru_cache, partial
from itertools import filterf... | StarcoderdataPython |
109424 | """ Hello world in python
"""
def helloworld():
""" print hello world to screen
"""
print "Hello world!"
if __name__ == '__main__':
helloworld()
| StarcoderdataPython |
1709790 | ## QUESTION
"""
Given an array Arr of size N, swap the Kth element from beginning with Kth element from end.
Example 1:
Input:
N = 8, K = 3
Arr[] = {1, 2, 3, 4, 5, 6, 7, 8}
Output: 1 2 6 4 5 3 7 8
Explanation: Kth element from beginning is
3 and from end is 6.
Example 2:
Input:
N = 5, K = 2
Arr[] = {5, 3, 6, 1, 2}
O... | StarcoderdataPython |
6555986 | import argparse
from functools import partial
import json
from pathlib import Path
from wsgiref import simple_server
from . import __version__ as version
from .handler import FeedifyHandler
feeds_file_cache = Path('.feeds')
if not feeds_file_cache.is_dir():
feeds_file_cache.mkdir(0o755)
parser = argparse.Argumen... | StarcoderdataPython |
1635882 | import arcade
from fish import ComputerFish, Fish
import random
import math
import abc
class FishGenerator(abc.ABC):
@abc.abstractmethod
def update(self,delta_t):
pass
class RandomFishGenerator(FishGenerator):
generation_rate: float
game_object: "MyGame"
generation_timer: float # timer un... | StarcoderdataPython |
8159793 | from typing import List, Tuple, Optional, Union, Any
import matplotlib as mpl
import matplotlib.axes
import matplotlib.patches as mpatches
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.collections import PatchCollection, LineCollection
from matplotlib.colors import Colormap
from natsort import nat... | StarcoderdataPython |
342889 | <filename>src/olympia/addons/tests/test_addon_utils.py<gh_stars>1-10
from olympia import amo
from olympia.amo.tests import TestCase
from olympia.addons.models import Addon
from olympia.addons.utils import reverse_name_lookup
class TestReverseNameLookup(TestCase):
fixtures = ('base/addon_3615',)
def setUp(sel... | StarcoderdataPython |
4906691 | <gh_stars>0
from django.apps import AppConfig
class IceCreamConfig(AppConfig):
name = 'ice_cream'
verbose_name = 'Управление сортами мороженого' | StarcoderdataPython |
22128 | <filename>seabird/cli.py<gh_stars>10-100
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" Command line utilities for package Seabird
"""
import click
from seabird.exceptions import CNVError
from .cnv import fCNV
from .netcdf import cnv2nc
@click.group()
def cli():
""" Utilities for seabird files
"""
pa... | StarcoderdataPython |
1606395 | from rxbp.mixins.flowablemixin import FlowableMixin
from rxbp.observables.tolistobservable import ToListObservable
from rxbp.subscriber import Subscriber
from rxbp.subscription import Subscription
class ToListFlowable(FlowableMixin):
def __init__(self, source: FlowableMixin):
super().__init__()
s... | StarcoderdataPython |
3330420 | import datetime
def response(flow):
print ("")
print ("=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=")
print (">>>> Request:")
print (flow.request.method + " " + flow.request.url)
for k,v in flow.request.headers.items():
print (k + ": " +... | StarcoderdataPython |
190284 | # Stack & Queue Review
# 9.3 valid paren
# 9.4 Longest Valid Paren
# "(()))(()())"
def longest_valid(s):
left_p, max_len, end = [], 0, -1
for ndx, p in enumerate(s):
if p == "(":
left_p.append(ndx)
# see a ")"
else:
if not left_p:
end = ndx
... | StarcoderdataPython |
3377013 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup
with open('README.md') as readme_file:
readme = readme_file.read()
with open('HISTORY.md') as history_file:
history = history_file.read()
with open("requirements.txt") as f:
requirements = [req.strip() for req in f.readlines()]
... | StarcoderdataPython |
6566812 | <reponame>bogomaz1987/ps4you<filename>ps4you/client/migrations/0001_initial.py<gh_stars>0
# Generated by Django 2.0.5 on 2018-05-30 19:51
import django.contrib.auth.models
from django.db import migrations
class Migration(migrations.Migration):
initial = True
dependencies = [
('user', '0001_initial'... | StarcoderdataPython |
8012501 | from wtforms import Form, BooleanField, StringField, validators, SubmitField
class RegistrationForm(Form):
fname = StringField('First Name:',[validators.Length(max=25)])
lname = StringField('Last Name:', [validators.Length(min=4, max=25)])
phno = StringField('Phone Number:')
email = StringField('Email ... | StarcoderdataPython |
9635271 | <reponame>ted80810/drb-estuary-salinity-ml
import os
import pandas as pd
import numpy as np
import yaml
import utils
# import config
with open("02_munge/params_config_munge_noaa_nerrs.yaml", 'r') as stream:
config = yaml.safe_load(stream)
# check where to read data inputs from
read_location = config['read_locatio... | StarcoderdataPython |
5154207 | <filename>CrySPY/utility.py
'''
Utility for CrySPY
'''
from datetime import datetime
import os
# ---------- parameters
bohr2ang = 0.529177210903
hrt2ev = 27.211386245988
ry2ev = 13.605693122994
kbar2ev_ang3 = 0.0006241509073
# ---------- functions
def get_version():
return 'CrySPY 0.10.1'
def get_date():
... | StarcoderdataPython |
194015 | import argparse
import tqdm
import random
import math
import os
import pandas as pd
import sklearn
import timeit
import numpy as np
import struct
import torch
import torch.nn as nn
import torch.optim as optim
from torch.autograd import Variable
import pickle
import torch
import pandas as pd
import torchvision
import ... | StarcoderdataPython |
4988325 | <reponame>raper03/login_example
import re
def error(key):
errorlist = {
'eight': '\tPassword is not at least eight characters',
'lower': '\tPassword does not have a lowercase letter',
'upper': '\tPassword does not have a uppercase letter',
'digit': '\tPassword does not have a numb... | StarcoderdataPython |
3465863 | <filename>tests/pipeline/nodes/model/movenetv1/test_predictor.py<gh_stars>1-10
# Copyright 2022 AI Singapore
#
# 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
#
# https://www.apache.org/lic... | StarcoderdataPython |
325963 | <filename>auxiliary/mc_more_precisely.py
import pandas as pd
import numpy as np
import statsmodels.formula.api as smf
#****************************************************************************************
#********************* COMPUTING MONTH OF CONCEPTION MORE PRECISELY *********************
#*******************... | StarcoderdataPython |
1663828 | <filename>stable_nalu/functional/gumbel.py
import torch
def sample_gumbel(placeholder, eps=1e-10, reuse=False):
"""Samples Gumbel(0, 1) values into the placeholder"""
# Uniform sample between [eps, 1)
if reuse:
uniform = placeholder
else:
uniform = placeholder.uniform_(eps, 1)
# ... | StarcoderdataPython |
11356474 |
from app.controllers.shopping_controller import ShoppingController
from app.data_access.personDAL import PersonDal
from app.helpers.mongodbConnector import Connection
connection=Connection()
connection.connect_mongodb()
shopping_controller = ShoppingController()
shopping_controller.create_shopping()
| StarcoderdataPython |
9798192 | # Copyright (c) 2020 PaddlePaddle 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 applic... | StarcoderdataPython |
11342259 | from __future__ import unicode_literals
from .common import InfoExtractor
from .ooyala import OoyalaIE
from ..utils import ExtractorError
class ViceIE(InfoExtractor):
_VALID_URL = r'https?://(?:.+?\.)?vice\.com/(?:[^/]+/)+(?P<id>.+)'
_TESTS = [
{
'url': 'http://www.vice.com/Fringes/cowbo... | StarcoderdataPython |
11288130 | import sys
import os
class AnsiColors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
class TestPrinter(object):
def __init__(self):
self.show_success = False
... | StarcoderdataPython |
4934754 | # Generated by rpcgen.py from portmap.x on Sat Nov 16 15:25:09 2019
PMAPPROC_NULL = 0
PMAPPROC_SET = 1
PMAPPROC_UNSET = 2
PMAPPROC_GETPORT = 3
PMAPPROC_DUMP = 4
PMAPPROC_CALLIT = 5
PMAP_PORT = 111
IPPROTO_TCP = 6
IPPROTO_UDP = 17
PMAP_PROG = 100000
PMAP_VERS = 2
| StarcoderdataPython |
8159881 | <gh_stars>1-10
"""
Endpoints to get the schemas
"""
# Import from libraries
from cornflow_client.airflow.api import Airflow
from flask import current_app
from flask_apispec.views import MethodResource
from flask_apispec import marshal_with, use_kwargs, doc
import logging as log
# Import from internal modules
from .me... | StarcoderdataPython |
1759116 | <reponame>NicGobbi/age-of-empires-II-api
from numpy import genfromtxt
import os
from db import db
from api.models.factory import get_model
def populate_db():
for filename in os.listdir(os.path.abspath('./data')):
if not filename.endswith('.csv'):
continue
data = load_data('data/{}'.fo... | StarcoderdataPython |
246326 | <reponame>yashsavani/NeRF-Project
##
%load_ext autoreload
%autoreload 2
##
##
import numpy as np
import matplotlib.pyplot as plt
from sklearn.datasets import make_blobs
##
##
theta = np.radians(30)
c, s = np.cos(theta), np.sin(theta)
R = np.array(((c, -s), (s, c)))
cov = np.array([[3, 0], [0, 0.4]]) @ R
data = np.ran... | StarcoderdataPython |
11393874 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
''' shared utility functions '''
import pkgutil
import shlex
import subprocess
import os
import platform
import tarfile
import hashlib
import urllib2
import json
import socket
import time
from threading import Timer
import pip
def get_available_port():
""" get a rando... | StarcoderdataPython |
5058816 | # sqlite3 handler
# TODO: More on prevention of SQL injection
import sqlite3
from utils.logger import log_adapter
logger = log_adapter.getlogger(__name__)
class DbHandler:
def __init__(self):
self.active = True
self.conn = sqlite3.connect('data.db')
def cleanup(self):
logger.debug("... | StarcoderdataPython |
9603903 | import sys
input = sys.stdin.readline
N, M = map(int, input().split())
adj = [ [] for _ in range(N) ]
indegree = [0] * N
for _ in range(M):
line = list(map(int, input().split()))
K = line[0]
if K == 0: continue
prev = line[1]
for cur in line[2:]:
indegree[cur-1] += 1
adj[prev-1].... | StarcoderdataPython |
132410 | class ParsimoniousError(Exception):
def __init__(self, exception):
"""
A class for wrapping parsimonious errors to make them a bit more sensible to users of this library.
:param exception: The original parsimonious exception
:return: self
"""
self.exception = except... | StarcoderdataPython |
6420598 | <filename>modules_lib/pyEMONCMS/models/node/node_model.py
# -*- coding: utf-8 -*-
#/*
# All Emoncms code is released under the GNU Affero General Public License.
# See COPYRIGHT.txt and LICENSE.txt.
#
# ---------------------------------------------------------------------
# Emoncms - open source energy ... | StarcoderdataPython |
15229 | # -*- coding: utf-8 -*-
#
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
#
# pylint: disable= no-member, arguments-differ, invalid-name
#
# Utilities for using pre-trained models.
import torch
from dgl.data.utils import _get_dgl_url, download
from .molecule... | StarcoderdataPython |
4945351 | <filename>setup.py<gh_stars>1-10
import setuptools
with open("README.md", "r") as f:
long_description = f.read()
setuptools.setup(
name='pyaw',
version='0.0.2',
description='Python Assembly Wrapper',
author='ninjamar',
url='https://github.com/ninjamar/pyaw',
packages=['pyaw'],
long_description=long... | StarcoderdataPython |
6695476 | <gh_stars>10-100
from __future__ import absolute_import
import os.path
from ocrd_utils import (
getLogger,
make_file_id,
assert_file_grp_cardinality,
MIMETYPE_PAGE
)
from ocrd_modelfactory import page_from_file
from ocrd_models.ocrd_page import (
to_xml, AlternativeImageType
)
from ocrd import Pro... | StarcoderdataPython |
9770840 | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from torchsummary import summary
from typing import Tuple
import math
class Swish(nn.Module):
def __init__(self):
super(Swish, self).__init__()
self.sigmoid = nn.Sigmoid()
def forward(s... | StarcoderdataPython |
1623669 | '''
Bremerton Weak Lensing Round Trip Module for CosmoSIS
ATTRIBUTION: CFHTLens
because this is a copy of the CFHTLens module with some minor modifications.
'''
from cosmosis.datablock import option_section, names as section_names
import bremerton_like
from bremerton_like import n_z_bin
import numpy as np
def setup(... | StarcoderdataPython |
3285455 | <reponame>Files-com/files-sdk-python
import unittest
import inspect
import files_sdk
from tests.base import TestBase
from files_sdk.models import FormField
from files_sdk import form_field
class FormFieldTest(TestBase):
pass
# Instance Methods
# Static Methods
if __name__ == '__main__':
unittest.main... | StarcoderdataPython |
1794448 | <reponame>franekp/interleave
def test_patterns(patterns):
def inner(f):
return f
return inner
| StarcoderdataPython |
11391749 | import ctypes
import errno
import os
import random
import socket
import struct
LIBC = ctypes.CDLL("libc.so.6")
IP_BIND_ADDRESS_NO_PORT = 24
SOCK_DIAG_BY_FAMILY = 20
NLM_F_REQUEST = 1
TCP_ESTABLISHED = 1
NETLINK_SOCK_DIAG = 4
NLMSG_ERROR = 2
INET_DIAG_NOCOOKIE = b'\xff' * 8
nl = None
ephemeral_lo = ephemeral_hi = ep... | StarcoderdataPython |
9686480 | <filename>canvas/core/routing.py
# coding: utf-8
'''
The module manages a dictionary tree with controller leaves to allow
approximately O(log n) route resolution. The tree is generated from a list of
controllers, as supplied by `create_controllers`, by `create_routing`. To
modify the resultant route map at create tim... | StarcoderdataPython |
247077 | <reponame>VsuManiego/machinery-mst
# TITLE: Checkpoint_2
# PROGRAMMER 1: <NAME>
# PROGRAMMER 2: <NAME>
# PROGRAMMER 3: <NAME>
mymachineinventory = {}
print("Welcome Engineer!")
print("You would like to have a better storage... | StarcoderdataPython |
1984059 | """Use a class 'instance' as a decorator demo.
Tracing decorator
"""
class Trace:
def __init__(self):
self.enabled = True
def __call__(self, function):
def wrap(*args, **kwargs):
if self.enabled:
print(f"** Tracer information - calling {function}")
return... | StarcoderdataPython |
8160826 | <gh_stars>10-100
#
# Copyright (c) <NAME> <<EMAIL>>
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merg... | StarcoderdataPython |
1949199 | # Generated by Django 3.0 on 2020-06-14 09:35
from django.conf import settings
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH... | StarcoderdataPython |
35428 | import asyncio
import pickle
from congregation.net.messages import *
class Handler:
def __init__(self, peer, server: [asyncio.Protocol, None] = None):
self.peer = peer
self.server = server
self.msg_handlers = self._define_msg_map()
def handle_msg(self, data):
"""
deter... | StarcoderdataPython |
1696305 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
from PyQt5.QtCore import QUrl
from PyQt5.QtWidgets import QApplication, QMainWindow
from PyQt5.QtWebEngineWidgets import QWebEngineView
LOGIN = '<LOGIN>'
PASSWORD = '<PASSWORD>'
with open('../QWebEngine__append_custom_javascript__jQuery/js/jq... | StarcoderdataPython |
6498602 |
import sys
import platform
import os
import datetime
import traceback
import tkinter
import build_info
import locations
# keep those trailing whites!!
TEXT = """
Sorry!
This was unexpected.
We created a Bugreport under: {bugreport}.
It would be great if you could send the bugreport to <EMAIL>
Th... | StarcoderdataPython |
3316725 | <reponame>elliottt/rules_tree_sitter<gh_stars>1-10
load("@rules_tree_sitter//tree_sitter/internal:versions.bzl", _get_version_info = "get_version_info")
_TREE_SITTER_BUILD = """
cc_library(
name = "tree_sitter_lib",
srcs = glob([
"lib/src/*.c",
"lib/src/*.h",
"lib/src/unicode/*.c",
... | StarcoderdataPython |
9684168 | <gh_stars>0
import requests
import logging
import http.client as http_client
import json
import pprint
LOGGING = True
LOGLEVEL = logging.DEBUG
if LOGGING:
http_client.HTTPConnection.debuglevel = 2
logging.basicConfig()
logging.getLogger().setLevel(LOGLEVEL)
requests_log = logging.getLogger("requests.packages... | StarcoderdataPython |
12809624 | #!/usr/bin/env python3
import fire
from cmd_interface import CommandlineInterface
def main():
fire.Fire(CommandlineInterface)
if __name__ == '__main__':
main()
| StarcoderdataPython |
3422059 | # -*- coding: utf-8 -*-
'''
Vdirsyncer is a synchronization tool for vdir. See the README for more details.
'''
# Packagers: Vdirsyncer's version is automatically detected using
# setuptools-scm, but that one is not a runtime dependency.
#
# Do NOT use the GitHub's tarballs, those don't contain any version information... | StarcoderdataPython |
4865384 | # -*- coding: utf-8 -*-
# Copyright (c) 2019, <NAME> and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
from datetime import datetime
from frappe.utils import getdate, add_days, get_time,get_datetime
from d... | StarcoderdataPython |
8065384 | <gh_stars>0
# Generated by Django 4.0.2 on 2022-03-24 00:22
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('app', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Funcionario',... | StarcoderdataPython |
5193654 | from django.contrib.auth import get_user_model
from django.db.models.signals import post_save
from django.dispatch import receiver
from accounts.models import RiddanceProfile
UserModel = get_user_model()
@receiver(post_save, sender=UserModel)
def user_created(sender, instance, created, **kwargs):
if cr... | StarcoderdataPython |
5063939 | #
# list_repo.py
#
import sys
import xml.dom.minidom
import gzip
def listRepo( repo_url ):
from urllib.request import urlopen
#
# Fetch repomd
#
with urlopen( '%s/repodata/repomd.xml' % (repo_url,) ) as req:
repomd = req.read()
dom = xml.dom.minidom.parseString( repomd )
for d... | StarcoderdataPython |
6446639 | <reponame>shyed2001/Python_Programming<gh_stars>1-10
#-------------------------------------------------------------------------------
# Name: module1
# Purpose:
#
# Author: user
#
# Created: 29/04/2019
# Copyright: (c) user 2019
# Licence: <your licence>
#---------------------------------... | StarcoderdataPython |
9695170 | <filename>HDPython/object_name_maker.py
from HDPython.base import g_add_global_reset_function
class objectName:
objectNameList = []
def __init__(self, objTypeName,MemberTypeNames):
self.objTypeName = objTypeName
self.MemberTypeNames = MemberTypeNames
self.HDL_objectName = None
de... | StarcoderdataPython |
1994449 | <reponame>vivekhub/razorpay-python<filename>tests/test_client_settlement.py
import responses
import json
from .helpers import mock_file, ClientTestCase
class TestClientSettlement(ClientTestCase):
def setUp(self):
super(TestClientSettlement, self).setUp()
self.base_url = '{}/settlements'.format(s... | StarcoderdataPython |
11262966 | <reponame>Toni-d-e-v/rxcsentinetal1
"""
ruxcryptod JSONRPC interface
"""
import sys
import os
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'lib'))
import config
import base58
from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCExcepti... | StarcoderdataPython |
1864048 | import os
import hydra
import jax
import jax.numpy as jnp
from flax.serialization import to_state_dict
from omegaconf import DictConfig, OmegaConf
from data import get_dataset
from models.jax import get_model
from neural_kernels.ntk import ntk_eigendecomposition
@hydra.main(config_path="config/compute_ntk", config_... | StarcoderdataPython |
210129 | import base64
import logging
import re
import subprocess
import os
import boto3
from botocore.exceptions import ClientError
from bentoml.exceptions import (
BentoMLException,
MissingDependencyException,
AWSServiceError,
)
logger = logging.getLogger(__name__)
# https://docs.aws.amazon.com/AWSCloudFormati... | StarcoderdataPython |
4920415 | <gh_stars>0
import xml.etree.ElementTree
import os
def parsing(a,b):
l = {}
for file in os.listdir(a):
key = b + "/" + file[0:len(file)-4] + ".jpg"
root = xml.etree.ElementTree.parse(a+"/"+file).getroot()
m = []
for x in root.findall('object'):
category = x.find('name').text
m.append(category)
... | StarcoderdataPython |
12839010 | # -*- coding: utf-8 -*-
import time
from pip_services3_components.log import CachedLogger, LogLevel
class LoggerFixture:
_logger: CachedLogger = None
def __init__(self, logger: CachedLogger):
self._logger = logger
def test_log_level(self):
assert self._logger.get_level() >= LogLevel.Not... | StarcoderdataPython |
3516197 | import yaml
with open('proxy_config_atlas.yaml', 'r') as stream:
proxy_config = yaml.safe_load(stream)
proxy_config['service_uris']['foundations_rest_api'] = 'http://localhost:37722'
with open('proxy_config_atlas.yaml', 'w') as outfile:
yaml.dump(proxy_config, outfile, default_flow_style=False) | StarcoderdataPython |
1722533 | <gh_stars>0
import sys
import os
import glob
import datetime
import json
# project imports
sys.path.insert(0, os.path.dirname(os.path.abspath('')))
from core.data import write_data_to_file, open_data_file
from core.generator import get_training_and_validation_generators
from core.model import isensee2017_model
from un... | StarcoderdataPython |
3563385 | <reponame>andylucny/JetBotDemos
import torch
from torchvision import transforms as T
import cv2
from PIL import Image
model_name = "trained_models/signatrix_efficientdet_coco.pth"
model = torch.load(model_name).module
model.cuda()
img_path = "../dataset/photo10.png"
image = cv2.imread(img_path)
image = cv2.resize(ima... | StarcoderdataPython |
1630193 | """Support functions for pyxmpp2 test suite."""
import os
import sys
import logging
import unittest
TEST_DIR = os.path.dirname(__file__)
DATA_DIR = os.path.join(TEST_DIR, "data")
RESOURCES = ['network', 'lo-network', 'gsasl']
if "TEST_USE" in os.environ:
RESOURCES = os.environ["TEST_USE"].split()
if "TEST_STAC... | StarcoderdataPython |
165945 | class BackendError(Exception):
pass
class ThreadStoppedError(Exception):
pass
| StarcoderdataPython |
3200045 | import numpy as np, re, pickle
from random import shuffle
def init_weight(size1, size2=0, mean = 0, sigma = .1):
if size2 == 0:
return np.random.normal(mean, sigma, (size1, 1))
return np.random.normal(mean, sigma, (size1, size2))
def get_n_feature(line1, line2):
nfeat = [0,0,0]
p = re.compile... | StarcoderdataPython |
11393399 | import unittest
import os
import numpy as np
from pmutt.io import gaussian
test_file = os.path.join(os.path.dirname(__file__), 'test_gaussian.log')
class TestGaussian(unittest.TestCase):
def test_read_zpe(self):
self.assertAlmostEqual(
gaussian.read_zpe(test_file, units='Ha/molecule'), 0.4515... | StarcoderdataPython |
1943992 | <filename>other_methods/sceloss/utils/utils.py
import csv
import sys
import numpy as np
class CSVLogger():
def __init__(self, args, fieldnames, filename='log.csv'):
self.filename = filename
self.csv_file = open(filename, 'w')
# Write model configuration at top of csv
writer = csv... | StarcoderdataPython |
4917728 | CELLTYPEMARKER_TOPOLOGIES = {}
| StarcoderdataPython |
8120330 | import click
from tabulate import tabulate
import ce_api
from ce_api.models import AuthEmail
from ce_cli.cli import cli
from ce_cli.utils import api_client, api_call
from ce_cli.utils import check_login_status, pass_info, Info
from ce_cli.utils import declare, confirmation
from ce_standards import constants
@cli.gro... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.