id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
209933 | <reponame>billyrrr/onto
from onto.attrs import attrs
from onto.models.base import Serializable as ValueObject
class AwardPool(ValueObject):
award_pool_id: int = attrs.doc_id
awards = attrs.set(attrs.embed('Award'))
class Award(ValueObject):
award_id: int = attrs.doc_id
probability: int = attrs.nothi... | StarcoderdataPython |
384024 | <reponame>neuro-inc/neuro-cli
from datetime import datetime, timezone
from decimal import Decimal
from typing import AsyncIterator, Callable
import pytest
from aiohttp import web
from yarl import URL
from neuro_sdk import Action, Client, Permission, Quota, ResourceNotFound
from tests import _TestServerFactory
_Make... | StarcoderdataPython |
3315407 | from copy import deepcopy
from logging import getLogger
import joblib
import numpy as np
import sklearn
import xarray as xr
from replay_trajectory_classification.bins import (atleast_2d, get_centers,
get_grid, get_track_grid,
... | StarcoderdataPython |
5056846 | #!/usr/bin/env python3
import sys
import time
import argparse
import subprocess
import logging as log
from pathlib import Path
import pandas as pd
from Bio import SeqIO
from flanker import cluster, salami
start = time.time()
__author__ = "<NAME>, <NAME>"
# arguments for the script
def get_arguments():
parse... | StarcoderdataPython |
6463476 | import wx
import wx.gizmos
import wx.lib
from wx.lib.scrolledpanel import *
import sys
import wxogre
from FlatNotebook import *
import ogre.renderer.OGRE as ogre
#from imagebrowser import *
import Image
import time
#import FreeImagePy as FIPY
from ogreyEntity import *
from ogreyLevel import *
from ogreyEntityTree imp... | StarcoderdataPython |
1638038 | <filename>post_processing/stella_plots.py<gh_stars>0
# -*- coding: utf-8 -*-
## some coding for commonly used plots
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rcParams
# setup some plot defaults
plt.rc('text', usetex=True)
plt.rc('font', family='serif')
plt.rc('font', size=30)
rcParams... | StarcoderdataPython |
1685271 | #!/usr/bin/python3
'''Scraper
'''
from abc import ABC, abstractmethod
class Scraper(ABC):
'''An abstract class for all scrapers.
'''
@abstractmethod
def get_name(self) -> str:
'''Retrieves the name of this scraper.
'''
pass
@abstractmethod
def get_manga_info(self, url:... | StarcoderdataPython |
3492726 | <gh_stars>1-10
import typing as t
import pytest
from corm import Entity, Field, KeyNested, Storage, Relationship, KeyManager
def test_nested_key():
class SomeEntity(Entity):
id: int = Field(pk=True)
name: str
class EntityHolder(Entity):
entity: SomeEntity = KeyNested(
re... | StarcoderdataPython |
11235493 | <gh_stars>0
from concurrent import futures
__copyright__ = '''
Copyright 2018 the original author or 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/... | StarcoderdataPython |
5130495 | # from soccerpy.modules.Fixture.fixture import Fixture | StarcoderdataPython |
6589295 | <filename>remove.py
traversed_links_file = open("traversed_links.txt", "r")
traversed_links = traversed_links_file.readlines()
go = []
count = 0
index = 0
while index < len(traversed_links):
if traversed_links[index].find("interforo") == -1 and traversed_links[index].find("blogspot") == -1 and traversed_links[inde... | StarcoderdataPython |
5135607 | <filename>av_utilities/convert.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
convert.py
Script to quickly convert an av file to another type.
Currently will convert from:
.mp3 (stereo)
.mxf (stereo)
.wav (stereo)
Currently will convert to:
.mp3 (stereo)
.wav (PCM signed 16-bit little-endi... | StarcoderdataPython |
39671 | <filename>tests/graphical/one_view.py
# -*- coding: utf-8 -*-
# Copyright (c) 2015-2016 MIT Probabilistic Computing Project
# 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.ap... | StarcoderdataPython |
11341355 | <filename>stellapy/GUI/graph_tools/OptionsWindow.py<gh_stars>1-10
#################################################################
# OPTIONS WINDOW OPENED FROM THE TOOLBAR
#################################################################
# Load modules
import tkinter as tk
from tkinter import ttk
# Load pe... | StarcoderdataPython |
9741982 | <reponame>surf-sci-bc/uspy
"""Data directories."""
from pathlib import Path
from uspy.version import __version__
DATADIR = str(Path.home() / "data") + "/"
LEEMDIR = DATADIR + "LEEM/"
XPSDIR = DATADIR + "XPS/"
STMDIR = DATADIR + "STM/home/stmwizard/Documents/"
| StarcoderdataPython |
3282523 | <filename>TwitOff/twitter_service.py
import os
from dotenv import load_dotenv
import tweepy
load_dotenv()
TWITTER_API_KEY = os.getenv("TWITTER_API_KEY")
TWITTER_API_SECRET = os.getenv("TWITTER_API_SECRET")
TWITTER_ACCESS_TOKEN = os.getenv("TWITTER_ACCESS_TOKEN")
TWITTER_ACCESS_TOKEN_SECRET = os.getenv("TWITTER_ACCES... | StarcoderdataPython |
317561 | from CommandBase import *
import json
from MythicResponseRPC import *
class ITermArguments(TaskArguments):
def __init__(self, command_line):
super().__init__(command_line)
self.args = {}
async def parse_arguments(self):
pass
class ITermCommand(CommandBase):
cmd = "iTerm"
nee... | StarcoderdataPython |
6425506 | <reponame>getty708/atr-tk<gh_stars>0
""" Initialize sensor nodes parameters.
"""
from tsndctl.device import TSND151
import time
from logging import getLogger
import hydra
from omegaconf import DictConfig, OmegaConf
logger = getLogger(__name__)
@hydra.main(config_path="conf", config_name="config.yaml")
def main(cfg: ... | StarcoderdataPython |
6652662 | # SPDX-License-Identifier: BSD-3-Clause
import pytest
from sklearn.datasets import make_classification
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import assert_raises
from skhubness.reduction import LocalScaling
from skhub... | StarcoderdataPython |
4956602 | <reponame>peterkulik/ois_api_client<gh_stars>1-10
from typing import Optional
import xml.etree.ElementTree as ET
from ...xml.XmlReader import XmlReader as XR
from ..namespaces import DATA
from ..dto.CustomerInfo import CustomerInfo
from .deserialize_address import deserialize_address
from .deserialize_tax_number import... | StarcoderdataPython |
6680389 | <filename>src/models/wisenet_base/models/lcfcn.py
import torch
import torch.nn as nn
import torchvision
import numpy as np
from .. import misc as ms
from .. import ann_utils as au
import torch.nn.functional as F
from . import base_model as bm
from skimage import morphology as morph
class LCFCN_BO(bm.BaseModel):
de... | StarcoderdataPython |
4864790 | import pathlib
import json
import enum
from cvat.apps.engine.models import Task
from django.conf import settings
from django.contrib.auth.models import User
from django.db import models
from opentpod.object_detector import provider
class Status(enum.Enum):
CREATED = 'created'
TRAINING = 'training'
TRAIN... | StarcoderdataPython |
9723073 | <gh_stars>0
import pickle
import click
import holoviews as hv
import hvplot
import hvplot.pandas # noqa
import pandas as pd
from bokeh.io import export_svgs
from .results import load_scores_errs
def export_svg(obj, filename):
plot_state = hv.renderer("bokeh").get_plot(obj).state
plot_state.output_backend =... | StarcoderdataPython |
1698400 | from flask import jsonify
import cloudinary
import cloudinary.uploader
import cloudinary.api as cloudAPI
from dotenv import load_dotenv
import os
load_dotenv()
cloud_name = os.environ["CLOUD_NAME"]
cloud_api_key = os.environ["API_KEY"]
cloud_api_secret = os.environ["API_SECRET"]
cloud_folder = os.environ["CLOUD_F... | StarcoderdataPython |
6573514 | <reponame>arfu2016/DuReader
"""
@Project : DuReader
@Module : module_test.py
@Author : Deco [<EMAIL>]
@Created : 5/14/18 1:51 PM
@Desc :
"""
import os
import sys
base_dir = os.path.dirname(
os.path.dirname(
os.path.abspath(__file__)))
if base_dir not in sys.path:
sys.path.insert(0, base... | StarcoderdataPython |
1997314 | <filename>tools/compile.py
#! /usr/bin/env python
# Copyright (C) 2020 Airbus, <EMAIL>
import sys, os
sys.path.insert(1, os.path.abspath(sys.path[0]+'/..'))
from plasmasm.python.utils import spawn
from tools.step2 import *
from tools.step2_plasmasm import *
from tools.step2_change import *
def usage():
sys.stder... | StarcoderdataPython |
3469637 | """文字列基礎
文字列を数値に変換する方法
上付き数字や下付き数字を数値変換したい場合
[説明ページ]
https://tech.nkhn37.net/python-str-num-translation/#unicodedatadigit
"""
import unicodedata
# unicodedata.digitを用いた変換
# 上付き数字/下付き数字の変換
num1 = unicodedata.digit('⁰')
print(num1)
num2 = unicodedata.digit('₁')
print(num2)
| StarcoderdataPython |
4969691 | from selenium import webdriver
# Chrome のオプションを設定する
options = webdriver.ChromeOptions()
options.add_argument('--headless')
# Selenium Server に接続する
driver = webdriver.Remote(
command_executor='http://localhost:4444/wd/hub',
desired_capabilities=options.to_capabilities(),
options=options,
)
# Selenium 経由でブ... | StarcoderdataPython |
3375332 | import math
from collections.abc import Sequence
import torch
from mmdet.models.builder import HEADS
@HEADS.register_module()
class HeatmapDecodeOneKeypoint():
"""Decodes a heatmap to return a keypoint Only consider the highest
intensity value, does not handle a 2 keypoints case."""
def __init__(self, ... | StarcoderdataPython |
6619815 | #!/home/amarchal/py2env/bin/python
'''This program build synthetic obs (21cm line) from T,n and vz which are the three-dimensional
field of the numerical simulation based on the work of Saury et al. 2014'''
import numpy as np
from glob import glob
from tqdm import tqdm
import matplotlib.pyplot as plt
from astropy.io ... | StarcoderdataPython |
1957914 | <gh_stars>1-10
# import json
# from server.helpers import encap_str
import re
from server.types import PageLanguage
from server.types import PageOperation
# from server.types import ResponseOperation
from server.types import PageParameters
from server.list import List
from server.question import Question
# from serv... | StarcoderdataPython |
28501 | <filename>users.py<gh_stars>0
import json, base64
import logging, coloredlogs
import hashlib, copy
from flask_table import Table, Col
logger = logging.getLogger(__name__)
coloredlogs.install(level='INFO')
class Users:
def __init__(self):
self.__users = self.__load_users("json/users.json")
self.... | StarcoderdataPython |
8042361 | from pettingzoo.utils.observation_saver import save_observation
import gym
import numpy as np
def check_save_obs(env):
for agent in env.agents:
assert isinstance(env.observation_spaces[agent], gym.spaces.Box), "Observations must be Box to save observations as image"
assert np.all(np.equal(env.obse... | StarcoderdataPython |
5196734 | from django.urls import re_path
from playlist import consumers
websocket_urlpatterns = [
re_path(r"^ws/playlist/device/$", consumers.PlaylistDeviceConsumer.as_asgi())
]
| StarcoderdataPython |
9762607 | <reponame>its-dirg/saml-metadata-upload
import os
from io import BytesIO
import pytest
from flask_transfer.exc import UploadError
from metadata_upload.validation import SAMLMetadataValidator
class TestSAMLMetadataValidator():
@pytest.fixture(autouse=True)
def create_validator(self):
self.validator =... | StarcoderdataPython |
8166755 | # coding=utf-8
"""Provide functionalities for managing I/O operations."""
from typing import Callable, List
def generic_vertex_ordering(
i: int,
N: int,
j: Callable = lambda i, N: i + N,
inc_i: int = 1,
inc_j: int = 1,
invert: bool = True,
) -> List:
"""Define the vertices order for each ... | StarcoderdataPython |
278743 | """Python API that wraps GeoIP country database lookup into a simple function.
Download the latest MaxMind GeoIP country database and read other docs here:
http://www.maxmind.com/app/geolitecountry
Copyright (C) 2009 <NAME>, released under the Lesser General Public License:
http://www.gnu.org/licenses/lgpl.tx... | StarcoderdataPython |
9749865 | <gh_stars>0
from datetime import datetime, timedelta
from timely_beliefs.beliefs.utils import load_time_series
from scipy.special import erfinv
from bokeh.palettes import viridis
from bokeh.io import show
from bokeh.models import ColumnDataSource, FixedTicker, FuncTickFormatter, LinearAxis
from bokeh.plotting import fi... | StarcoderdataPython |
1901435 | num = 10
num2=20
明天放假
| StarcoderdataPython |
4802592 | <filename>pyspedas/omni/tests/tests.py<gh_stars>10-100
import os
import unittest
import pandas as pd
from pyspedas.utilities.data_exists import data_exists
import pyspedas
class LoadTestCases(unittest.TestCase):
def test_utc_timestamp_regression(self):
varname = 'BX_GSE'
data_omni = pyspedas.omni... | StarcoderdataPython |
3262805 | <reponame>bqmoreland/EASwift
import sys
import tkinter as tk
from tkinter import ttk
import math
import time
import random
from tkinter import messagebox
from PIL import Image, ImageTk
from tkinter.filedialog import askopenfilename
from tkinter.filedialog import asksaveasfilename
ord_a = ord("A")
infinit... | StarcoderdataPython |
8179936 | <reponame>Tea-n-Tech/chia-tea
from chia.rpc.harvester_rpc_client import HarvesterRpcClient
from chia.util.config import load_config
from chia.util.default_root import DEFAULT_ROOT_PATH
from chia.util.ints import uint16
from ....models.ChiaWatchdog import ChiaWatchdog
from ....utils.logger import log_runtime_async
from... | StarcoderdataPython |
246992 | """\
This implements a command line interpreter (CLI) for the concur API.
OAuth data is kept in a JSON file, for easy portability between different
programming languages.
Currently, the initialization of OAuth requires the user to copy a URL
into a web browser, then copy the URL of the resulting page back to this
scr... | StarcoderdataPython |
1710544 | <gh_stars>1-10
# Generated by Django 3.0.8 on 2020-08-02 07:09
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('person', '0014_auto_20200728_2104'),
]
operations = [
migrations.AddField(
model_name='person',
name=... | StarcoderdataPython |
1808654 | ## TODO: define the convolutional neural network architecture
import torch
from torch.autograd import Variable
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
# can use the below import should you choose to initialize the weights of your Net
import torch.nn.init as I
# maxpool layer
max_k = 2... | StarcoderdataPython |
12847234 | <reponame>quanganh1997polytechnique/Project-DL-Seq2Seq<gh_stars>0
"""
** deeplean-ai.com **
created by :: GauravBh1010tt
contact :: <EMAIL>
"""
from __future__ import unicode_literals, print_function, division
import math
import re
import os
import numpy as np
import torch
import random
import warnings
from io import... | StarcoderdataPython |
1702195 | <filename>scraper/scrape.py
from datetime import datetime
from json import loads, dumps
from os import path, makedirs
from threading import Thread
from time import sleep
from urllib2 import quote
from tweepy.api import API
from tweepy.auth import OAuthHandler
from tweepy.cursor import Cursor
from tweepy.error import T... | StarcoderdataPython |
9718705 | <reponame>xn-twist/squat-monitor
from django.apps import AppConfig
class TwisterConfig(AppConfig):
name = 'twister'
| StarcoderdataPython |
1806497 | <reponame>yangheng111/AnnotatedNetworkModelGit
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import torch
import torch.nn.functional as F
import torchvision.transforms.functional as tvF
import os
import numpy as np
# from math import log10
from datetime import datetime
# import OpenEXR
# import pyopenexrates
# from ... | StarcoderdataPython |
3323323 | <reponame>rzsaglam/project-env<filename>projectenv/main/migrations/0010_alter_paint_table.py
# Generated by Django 3.2.3 on 2021-05-31 07:48
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('main', '0009_alter_paint_table'),
]
operations = [
migr... | StarcoderdataPython |
1920540 | <reponame>sadmanbd/social-lead-generator
import os
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from . import database, models, routers
models.Base.metadata.create_all(bind=database.engine)
app = FastAPI()
origins = os.getenv("ALLOWED_ORIGINS", "").split(",")
app.add_middleware(... | StarcoderdataPython |
1616384 | import tensorflow as tf
from tensorflow.keras.layers import Attention
class MultiHeadAttention(tf.keras.layers.Layer):
def __init__(self, embed_dim=512, num_heads=8, dropout_rate=0.1, causal=False):
super(MultiHeadAttention, self).__init__()
self.embed_dim = embed_dim
self.num_heads = num_... | StarcoderdataPython |
8048835 | <gh_stars>0
# coding: utf-8
# adapters/repository.py
import abc
from domain import model
from sqlalchemy.orm import Session
from typing import List
class AbstracRepository(abc.ABC):
@abc.abstractmethod
def add(self, model: object):
raise NotImplementedError
@abc.abstractmethod
def get(self,... | StarcoderdataPython |
11252065 | from django.db import models
from django.utils.translation import ugettext_lazy as _
import django
try:
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
except ImportError: # Django < 1.9
from django.contrib.contenttypes.generic im... | StarcoderdataPython |
8078544 | <filename>python/picture_logic.py
from cv2 import cv2
def take_picture():
camera = cv2.VideoCapture(0)
saved_image_name = 'trash_object.jpg'
print(saved_image_name)
while True:
return_value, raw_image = camera.read()
display_image = raw_image
font = cv2.FONT_HERSHEY_SIMPLEX
... | StarcoderdataPython |
9653965 | #! /usr/bin/env python3
import logging
import json
import os, sys, tempfile
import copy
import glob
import subprocess
import shutil
from jsonmerge import merge
from cwltool.executors import SingleJobExecutor
from cwltool.stdfsaccess import StdFsAccess
from cwltool.workflow import expression
from cwltool.context impor... | StarcoderdataPython |
134282 | # Copyright 2020 The TensorFlow Probability 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/LICENSE-2.0
#
# Unless required by applicable law o... | StarcoderdataPython |
11245336 | # Python program to print all positive Numbers in a range
#note : I'm using two different codes for two different list
#1] list of numbers using for loop
list1 = [12, -7, 5, 64,-14]
# iterating each number in list
for num in list1:
# checking condition
if num >= 0:
print(num,end = " "):
... | StarcoderdataPython |
11301790 | <filename>cea/demand/metamodel/nn_generator/nn_presampled_caller.py
# coding=utf-8
"""
'nn_trainer.py' script fits a neural net on inputs and targets
"""
__author__ = "<NAME>"
__copyright__ = "Copyright 2017, Architecture and Building Systems - ETH Zurich"
__credits__ = ["<NAME>"]
__license__ = "MIT"
__version__ = "0.... | StarcoderdataPython |
5012999 | import unidecode
import re
from collections import *
def _removeDiacritics(word):
return unidecode.unidecode(word)
def _removeDashes(word):
return re.sub(r"[^a-zA-Z]+", r"", word)
def normalize(word):
return _removeDashes(_removeDiacritics(word))
def computeFeed(words):
feed = list(map(lambda w: [w[... | StarcoderdataPython |
3567724 | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.distributions import Distribution, Normal, Categorical, Independent
from torch.distributions import register_kl
class MixtureSameFamily(Distribution):
"""
A distribution made of a discrete mixture of K distributions of the same fami... | StarcoderdataPython |
8192741 | import pytest
from numpy.testing import assert_array_almost_equal
from numpy import array
from carsons.carsons import convert_geometric_model
# `carsons` implements the model entirely in SI metric units, however this
# conversion allows us to enter in impedance as ohm-per-mile in the test
# harness, which means we can... | StarcoderdataPython |
4916621 | <reponame>YeoLab/gscripts<filename>gscripts/rnaseq/helpers.py
__author__ = 'gpratt'
import pandas as pd
import pyBigWig
import pybedtools
import scipy
def counts_to_rpkm(featureCountsTable):
"""
Given a dataframe or a text file from featureCounts and converts that thing into a dataframe of RPKMs
"""
if ... | StarcoderdataPython |
4940003 | <reponame>RiverArchitect/program
# !/usr/bin/python
try:
import sys, os, arcpy, logging, random
from arcpy.sa import *
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) + "\\.site_packages\\riverpy\\")
import config
import cReachManager as cRM
import cDefini... | StarcoderdataPython |
11336783 | import urllib.request, sys,base64,json,os,time,string,re
from PIL import Image
from aip import AipOcr
from aitext import Ai
start = time.time()
os.system("adb shell /system/bin/screencap -p /sdcard/screenshot.png")
os.system("adb pull /sdcard/screenshot.png ./screenshot.png")
'''
汉王ocr 涨价涨价了。。
host = 'http://text.ali... | StarcoderdataPython |
6552335 | <filename>src/submanager/utils/output.py
"""Utility functions and classes for handling and printing output."""
# Future imports
from __future__ import (
annotations,
)
def format_error(error: BaseException) -> str:
"""Format an error as a human-readible string."""
return f"{type(error).__name__}: {error}... | StarcoderdataPython |
6494812 | import theano.tensor as T
from .layer import Layer
from ..utils.utils_functions import ActivationFunctions
from ..utils.utils_translation import TextTranslation
__all__ = ['Convolution1D', 'Convolution2D']
class ConvolutionBase(Layer):
""" Convolution Layer Class Base-
Parameters
----------
num_fil... | StarcoderdataPython |
3511421 | <gh_stars>0
# Generated by Django 3.1.1 on 2020-09-20 22:45
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('equipment', '0001_initial'),
]
opera... | StarcoderdataPython |
6517138 | #! /usr/bin/env python
import sys, time
import Pyro.naming, Pyro.core
from Pyro.protocol import getHostname
# initialize the client and set the default namespace group
Pyro.core.initClient()
# locate the NS
locator = Pyro.naming.NameServerLocator()
print 'Searching Naming Service...',
ns = locator.getNS()
print 'Nam... | StarcoderdataPython |
6541769 | <reponame>kreczko/l1t-cli
"""
dqm gui setup:
Sets up the DQM GUI. It will be available at port localhost:8060/dqm/dev
From https://twiki.cern.ch/twiki/bin/view/CMS/DQMGuiForUsers
Usage:
dqm gui setup
"""
import logging
import os
import string
import hepshell
from hepshell.inter... | StarcoderdataPython |
11228443 | getAllObjects = [{
'accountId': 123456,
'createDate': '2020-09-15T13:12:08-06:00',
'id': 112356450,
'modifyDate': '2020-09-15T13:13:13-06:00',
'status': 'COMPLETED',
'userRecordId': 987456321,
'userRecord': {
'username': '<EMAIL>'
},
'items': [
{
'category... | StarcoderdataPython |
3231585 | import traceback
from flask import current_app
from urllib.parse import urljoin
from ..lib import utils
from .base import db
from .setting import Setting
from .user import User
from .account_user import AccountUser
class Account(db.Model):
__tablename__ = 'account'
id = db.Column(db.Integer, primary_key=True... | StarcoderdataPython |
1877445 | from unittest import TestCase
from eynnyd.exceptions import RouteBuildException, NonCallableInterceptor, \
NonCallableHandler, CallbackIncorrectNumberOfParametersException
from eynnyd.routes_builder import RoutesBuilder
class TestRoutesBuilder(TestCase):
def test_add_uncallable_request_interceptor_raises(se... | StarcoderdataPython |
4906534 | <reponame>zopefoundation/zope.app.applicationcontrol
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A cop... | StarcoderdataPython |
1963278 | food = (
"http://kuaibao.qq.com/s/MEDIANEWSLIST?chlid=5792078",
"http://kuaibao.qq.com/s/MEDIANEWSLIST?chlid=5777522",
"https://kuaibao.qq.com/s/MEDIANEWSLIST?chlid=5332821",
"http://kuaibao.qq.com/s/MEDIANEWSLIST?chlid=6529876",
"http://kuaibao.qq.com/s/MEDIANEWSLIST?chlid=5632000",
"http://kua... | StarcoderdataPython |
172486 | from mesa.datacollection import DataCollector
from mesa import Model
from mesa.time import RandomActivation
from mesa_geo.geoagent import GeoAgent, AgentCreator
from mesa_geo import GeoSpace
import random
class SchellingAgent(GeoAgent):
"""Schelling segregation agent."""
def __init__(self, unique_id, model, ... | StarcoderdataPython |
1762882 | <filename>rankers/LevenshteinRanker/tests/test_levenshteinranker.py
__copyright__ = "Copyright (c) 2021 Jina AI Limited. All rights reserved."
__license__ = "Apache-2.0"
from jina.executors.rankers import Match2DocRanker
from .. import LevenshteinRanker
def test_levenshteinranker():
queries_metas = [{'text': 'c... | StarcoderdataPython |
4884460 | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft and contributors. 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 ... | StarcoderdataPython |
3552802 | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: modules/dreamview/proto/hmi_status.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf ... | StarcoderdataPython |
3330269 | """
Process launcher for run an ad-hoc job
"""
import yaml
import json
import datetime
import tempfile
import time
import sys
import os
from msbase.utils import getenv, datetime_str
from msbase.logging import logger
from common import get_jobs_config
from model import DB
from resource import Resource
from notif impor... | StarcoderdataPython |
9647244 |
import sys, os
import py
from jirpa import JiraProxy, JiraProxyError
###############################################################################################
from helper_pak import BasicLogger, excErrorMessage
from jira_targets import GOOD_VANILLA_SERVER_CONFIG
from jira_targets import PROJECT_KEY_1, PROJEC... | StarcoderdataPython |
5021757 | <reponame>everarch/psets
#
# Matching Start & End
#
# https://www.hackerrank.com/challenges/matching-start-end/problem
#
Regex_Pattern = r"^\d\w{4}\.$" # Do not delete 'r'.
import re
print(str(bool(re.search(Regex_Pattern, input()))).lower())
| StarcoderdataPython |
3350345 | import json
import feedparser
import nltk
from bs4 import BeautifulSoup
from nltk.tokenize import sent_tokenize
nltk.download('punkt')
feeds = ["http://export.arxiv.org/rss/cs.AI",
"http://export.arxiv.org/rss/cs.CL",
"http://export.arxiv.org/rss/cs.CV",
"http://export.arxiv.org/rss/cs.IR"... | StarcoderdataPython |
3267921 | class MaximumNumberOfOccupantsReached(Exception):
pass
class Tenant:
def __init__(self, first_name: str, last_name: str, student_id_number: int) -> None:
self.first_name = first_name
self.last_name = last_name
self.student_id_number = student_id_number
@property
def full_name(... | StarcoderdataPython |
3344286 | from django.conf.urls import include, url
from corehq.apps.app_manager.views import (
AppCaseSummaryView,
AppDataView,
AppDiffView,
AppFormSummaryView,
DownloadAppSummaryView,
DownloadCaseSummaryView,
DownloadCCZ,
DownloadFormSummaryView,
FormHasSubmissionsView,
FormSummaryDiffV... | StarcoderdataPython |
1763718 | <filename>tests/lspopt_ref.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
:mod:`lspopt_ref`
==================
.. module:: lspopt_ref
:platform: Unix, Windows
:synopsis:
.. moduleauthor:: hbldh <<EMAIL>>
Created on 2015-11-13
"""
from __future__ import division
from __future__ import print_function
f... | StarcoderdataPython |
3416652 | <gh_stars>0
# Copyright 2020 <NAME> (@usimarit)
#
# 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 agr... | StarcoderdataPython |
1962440 | <reponame>JuanCruzMedina/betterpros
from typing import Optional
from pydantic import BaseModel
class UserOut(BaseModel): # serializer
user_id: int
user_name: str
email: str
last_conversation_id: Optional[str] = None
| StarcoderdataPython |
8093094 | # -*- coding: utf-8 -*-
"""
Created on Mon Aug 1 10:55:12 2020
pj: Siteblocker
@author: Hyu1
"""
#Before run this, make sure you run the program to adminstrator (to access to host file)
#Import time.
#import mysql.
import mysql.connector as mysql
db = mysql.connect (
host = "localhost",
user = ... | StarcoderdataPython |
11358873 | import numpy as np
import re
import random
import collections
from string import punctuation
add_punc=',。、【 】 “”:;()《》‘’{}?!⑦()、%^>℃:.”“^-——=&#@¥'
all_punc=punctuation+add_punc
# 对文本的预处理
class PreProcess(object):
"""
1、读取数据
2、构建词表
3、提供获取方法
"""
def __init__(self,preparams):
self.sentences = []
... | StarcoderdataPython |
11362879 | #euklidov algoritam racunanja NZD
#(iterativni)
x = int(input("Unesi X "))
y = int(input("Unesi Y "))
while x != y:
if x > y:
x = x - y
else:
y = y -x
print("NZD = ", x)
| StarcoderdataPython |
1633858 | <reponame>WorldWideTelescope/pywwt-web<filename>pywwt/utils.py
import numpy as np
import pytz
from astropy.io import fits
from astropy.coordinates import ICRS
from astropy.time import Time
from datetime import datetime
from reproject import reproject_interp
from reproject.mosaicking import find_optimal_celestial_wcs
_... | StarcoderdataPython |
1653775 | <filename>03_customer_tensorflow_keras_nlp/util/preprocessing.py<gh_stars>10-100
from __future__ import division
# Python Built-Ins:
import gzip
import os
import shutil
import subprocess
import tarfile
import time
from typing import Optional
# External Dependencies:
import numpy as np
from sklearn import preprocessin... | StarcoderdataPython |
1756158 | <gh_stars>1-10
# flake8: noqa
from .. import conf
from .fields import ImageSpecField, ProcessedImageField
| StarcoderdataPython |
4986474 | <filename>aizynthfinder/context/policy/policies.py
""" Module containing classes that interfaces neural network policies
"""
from __future__ import annotations
from typing import TYPE_CHECKING
from aizynthfinder.utils.loading import load_dynamic_class
from aizynthfinder.utils.exceptions import PolicyException
from aiz... | StarcoderdataPython |
1692899 | # -*- coding: utf-8 -*-
# Copyright 2017 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Module containing infra build stages."""
from __future__ import print_function
import os
import shutil
from chromite.cbuildb... | StarcoderdataPython |
6697087 | <reponame>rpharoah/42-workshop<filename>fortytwo/s32_autorun_tests.py
"""32: Auto-Run Tests
Get into testing mode by telling PyCharm to automatically
re-run tests as you type.
- Click the auto-test button and click Play
- Change ``test_32`` that causes failure
- Fix, don't save...still runs
- Configurable delay
R... | StarcoderdataPython |
50459 | <filename>indice_pollution/__init__.py
import requests
import csv
from sqlalchemy.orm import joinedload
from indice_pollution.history.models.commune import Commune
from indice_pollution.history.models.indice_atmo import IndiceATMO
from indice_pollution.history.models.episode_pollution import EpisodePollution
from flas... | StarcoderdataPython |
376732 | from .cog import BotLog
def setup(bot):
bot.add_cog(BotLog(bot))
| StarcoderdataPython |
6653805 | <gh_stars>0
num1 = int(input())
num2 = int(input())
print(num1-num2) | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.