id stringlengths 1 7 | text stringlengths 6 1.03M | dataset_id stringclasses 1
value |
|---|---|---|
1627321 | # Copyright 2015 Cloudbase Solutions Srl
# 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 r... | StarcoderdataPython |
1682861 | <reponame>huntc/conductr-cli<filename>typesafe_conductr_cli/test/test_conduct_run.py
from unittest import TestCase
from unittest.mock import patch, MagicMock
from typesafe_conductr_cli.test.cli_test_case import CliTestCase, strip_margin
from typesafe_conductr_cli import conduct_run
class TestConductRunCommand(TestCas... | StarcoderdataPython |
134589 | # Copyright (c) "Neo4j"
# Neo4j Sweden AB [http://neo4j.com]
#
# This file is part of Neo4j.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0... | StarcoderdataPython |
117448 | <gh_stars>0
def hashadNum(num):
digitSum = sum([int(k) for k in str(num)])
if num % digitSum == 0:
return True
else:
return False
n = int(input())
while not (hashadNum(n)):
n += 1
print(n) | StarcoderdataPython |
3338161 | class Matrix(object):
def __init__(self, matrix_string):
self.values = self._decode(matrix_string)
def _decode(self, matrix_string):
decoded_rows = matrix_string.split("\n")
return [list(map(int, row.split())) for row in decoded_rows]
def row(self, index):
return self.value... | StarcoderdataPython |
3280503 | # coding: utf-8
"""
Hydrogen Integration API
The Hydrogen Integration API # noqa: E501
OpenAPI spec version: 1.3.1
Contact: <EMAIL>
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
from integration_api.configuration import ... | StarcoderdataPython |
1666413 | #!/usr/bin/env python
"""
Configure folder for RCC drift correction testing.
Note: This test takes approximately 20-30 minutes.
Hazen 09/18
"""
import numpy
import storm_analysis.simulator.emitters_in_clusters as emittersInClusters
import storm_analysis.simulator.emitters_on_lines as emittersOnLines
import storm_an... | StarcoderdataPython |
190701 | # Copyright (c) 2021 <NAME>. All Rights Reserved.
from maya.app.general.mayaMixin import MayaQWidgetDockableMixin
import maya.OpenMaya as om
import pymel.core as pm
import piper_config as pcfg
import piper.core.util as pcu
from piper.ui.widget import manager
from piper.ui.switcher import Switcher
from piper.mayapy.p... | StarcoderdataPython |
3393036 | <reponame>serik1987/corefacility<filename>corefacility/core/test/entity_set/token/base_test_class.py
from time import sleep
from datetime import timedelta
from parameterized import parameterized
from core.entity.entity_exceptions import EntityNotFoundException
from ..base_test_class import BaseTestClass
from ..entity... | StarcoderdataPython |
1722514 | import re
PARTITION_METADATA_PATTERN = re.compile('.*CONST (:.*) \[')
KEY_WITH_METADATA_43_TO_5 = ["parrangestart", "parrangeend", "parrangeevery", "parlistvalues"]
KEY_WITH_METADATA = ["version", "parrangestartincl"] + KEY_WITH_METADATA_43_TO_5
# These columns contain CONST or other nodes that may contain :location ... | StarcoderdataPython |
189743 | from pyrt.point import Point3
from pyrt.vec3 import Vec3
def test_point_point_addition():
assert isinstance(Point3(0, 0, 0) + Point3(0, 0, 0), Vec3)
def test_point_vec_addition():
assert isinstance(Point3(0, 0, 0) + Vec3(0, 0, 0), Point3)
assert isinstance(Vec3(0, 0, 0) + Point3(0, 0, 0), Point3)
| StarcoderdataPython |
8473 | # -*- coding: utf-8 -*-
"""
mundiapi
This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ).
"""
class UpdatePlanRequest(object):
"""Implementation of the 'UpdatePlanRequest' model.
Request for updating a plan
Attributes:
name (string): Plan's n... | StarcoderdataPython |
3341633 | """ Functions to easily download census data for a given geography. """
import os
import pandas as pd
from census import Census
from itertools import chain
from functools import reduce
from dotenv import load_dotenv
from dotenv import find_dotenv
def census_key():
""" Retrieve the Census API key.
:retur... | StarcoderdataPython |
138704 | <filename>subproc_env.py
#!/usr/bin/env python3
import numpy as np
import time
import gym
from typing import Callable
from subproc import subproc
from multi_env import MultiEnv
from phonebot.sim.pybullet.simulator import PybulletPhonebotEnv, PybulletSimulatorSettings
@subproc
class PybulletPhonebotSubprocEnv(Pybul... | StarcoderdataPython |
3218976 | # Copyright 2021, UChicago Argonne, LLC
# All Rights Reserved
# Software Name: repast4py
# By: Argonne National Laboratory
# License: BSD-3 - https://github.com/Repast/repast4py/blob/master/LICENSE.txt
from typing import List
from pathlib import Path
# class Timer:
# def __init__(self):
# self.times = {... | StarcoderdataPython |
3397639 | num = list()
pares = list()
impares = list()
while True:
num.append(int(input('Digite um número: ')))
continuar = ' '
while continuar not in 'SN':
continuar = str(input('Quer continuar? [S/N] ')).strip().upper()[0]
if continuar in 'N':
break
for i, v in enumerate(num):
if v % 2 == 0:... | StarcoderdataPython |
117236 | <filename>ChunkProcessingContinuation/dataframe_continue.py
import pandas as pd
class Continue:
def __init__(
self,
path_old=None,
path_new=None,
path_init=None,
chunk_path=None,
chunk_processing=None,
chunksize=None
):
self.path_old... | StarcoderdataPython |
194894 | import sys
from termcolor import cprint
from colorama import init
from pyfiglet import figlet_format
import pyperclip
cprint(figlet_format('Geometry', font='small'), 'blue', attrs=['bold', 'blink'])
cprint('==============================================', 'white', attrs=['blink'])
cprint('Scientific Calculator... | StarcoderdataPython |
3209906 | <gh_stars>1-10
# Generated by Django 4.0.2 on 2022-03-13 20:11
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0037_alter_moveoutnotice_reason_and_more'),
]
operations = [
migrations.AlterModelOptions(
name='contact'... | StarcoderdataPython |
1786355 | <filename>src/texttospeechservice/src/util/locale_manager.py
import csv
class LocaleManager:
""" Utility class to handle locale data and transform languages to a given default locale.
This class handles the locales supported by our tts service. It should be used to check
if the locale provided by the user... | StarcoderdataPython |
55727 | <gh_stars>10-100
#!/usr/bin/env python
# encoding: utf-8
"""
Implements the Newman-Ziff algorithm for Monte Carlo simulation of percolation
This module implements the Newman-Ziff algorithm for Monte Carlo simulation of
Bernoulli percolation on arbitrary graphs.
The :mod:`percolate` module provides these high-level f... | StarcoderdataPython |
1667915 | <gh_stars>0
from gpiozero import Button
button=Button(4)
button.wait_for_release()
print ("Door opened")
| StarcoderdataPython |
3257402 | <reponame>Riteme/test<gh_stars>1-10
#!/usr/bin/env pypy
from sys import *
from random import *
n = int(argv[1])
print n
for v in xrange(2, n + 1):
u = randint(max(1, v - 10), v - 1)
print u, v
| StarcoderdataPython |
1614423 | <reponame>pbx/Mercurial<gh_stars>10-100
from AAAPT.runner import register_tests
TESTS_CLIENT = 'Mercurial.tests.shglib.test_client'
TESTS_PARSING = 'Mercurial.tests.shglib.test_parsing'
TESTS_LOG_SUPPORT = 'Mercurial.tests.shglib.test_log_support'
TESTS_ALL_CLIENT = [TESTS_CLIENT]
TESTS_ALL_PARSING = [TESTS_PARSING]... | StarcoderdataPython |
47889 | def sommig(n):
result = 0
while(n>=1):
result += n
n-=1
return result
print(sommig(3))
print(sommig(8))
print(sommig(17))
print(sommig(33)) | StarcoderdataPython |
1604072 | <reponame>Darij/Darij-code-challange-fs-dario
import json
class Suggester:
"""Object to query and return results as suggestions
"""
def __init__(self, qFilter, rFilter, sFilter):
self.matches = []
self.q_filter = qFilter
self.rate_filter = rFilter
self.skill_filter = sFilt... | StarcoderdataPython |
3316832 | #!/usr/bin/env python3
# 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 logging
import os
from habitat.core.logging import HabitatLogger
baselines_logger = HabitatLogger(
name="ha... | StarcoderdataPython |
1647799 | <gh_stars>0
#################################################################
# #
# ASCII-Chess, written by <NAME> in 2021 #
# #
#######################################################... | StarcoderdataPython |
85145 | import argparse
import asyncio
import logging
import math
import os
import cv2
import numpy
from aiortc import RTCPeerConnection
from aiortc.mediastreams import VideoFrame, VideoStreamTrack
from signaling import CopyAndPasteSignaling
BLUE = (255, 0, 0)
GREEN = (0, 255, 0)
RED = (0, 0, 255)
OUTPUT_PATH = os.path.joi... | StarcoderdataPython |
1776853 | translate = {
'English': {
'main_title': 'Sahm',
'sub_title': 'Intelligent financial system',
'Insert_Data': 'Insert Data',
'Symbol': 'Symbol',
'Prediction_days': 'Prediction days',
'Date_Range': 'Date Range',
'Select_a_range_of_Date': 'Select a range of Date'... | StarcoderdataPython |
30186 | import newspaper
from newspaper import Article
def getarticle(url):
articleurl = url
article = Article(articleurl)
try:
article.download()
article.parse()
alltext = article.text
return alltext
except:
return "this website is not available"
| StarcoderdataPython |
3389774 | <filename>modelscript/metamodels/megamodels/__init__.py
# # coding=utf-8
#
METAMODEL=None # Will be filled by
def _setMetaModel(m2):
global METAMODEL
METAMODEL=m2 | StarcoderdataPython |
1710070 | import sys
sys.path.insert(0, './src/uri/basic')
import unittest
from basic_1007 import SimpleDiference
class TestSimpleDiference(unittest.TestCase):
def setUp(self) -> None:
self.test = SimpleDiference()
def test(self):
self.assertEqual(self.test.solution(5, 6, 7, 8), 'DIFERENCA = -26')
... | StarcoderdataPython |
4809476 | <reponame>JeyDi/E-Grid<gh_stars>1-10
import csv
import urllib
import names
import requests
import yaml
with open('../maps/azuremaps_config.yml', encoding="utf8") as file:
configs = yaml.load(file, Loader=yaml.FullLoader)
url = "https://atlas.microsoft.com/search/address/json?"
i = 900
addresses = {}
with open("... | StarcoderdataPython |
81405 | """ct.py: Constant time(ish) functions"""
# WARNING: Pure Python is not amenable to the implementation of truly
# constant time cryptography. For more information, please see the
# "Security Notice" section in python/README.md.
def select(subject, result_if_one, result_if_zero):
# type: (int, int, int) -> int
... | StarcoderdataPython |
157548 | # -*- coding: utf-8 -*-
__author__ = 'Администратор'
from model.contact import Contact
from model.group import Group
from fixture.orm import ORMFixture
import random
def test_add_contact_in_group(app, db):
db = ORMFixture(host="127.0.0.1", name = "addressbook", user="root", password="")
if len(db.get_contact_l... | StarcoderdataPython |
36268 | <gh_stars>1-10
import datetime
from typing import List, Union
import numpy as np
from sqlalchemy.dialects.postgresql import insert
from sqlalchemy.types import Date, Float, Integer, Numeric, String
import omicron
from omicron import db
from omicron.client.quotes_fetcher import get_valuation
class Valuation(db.Model... | StarcoderdataPython |
1631659 | <reponame>guanidene/pySudokuSolver
# -*- coding: UTF-8 -*-
"""This is a very important module contributing to both gui and logic.
The attribute LabelsRestrictionCount of the class SudkouCell is a very
important attribute in the working of this app."""
__author__ = u"पुष्पक दगड़े (<NAME>)"
import sys
from PyQt4 import... | StarcoderdataPython |
3260594 | <reponame>jefalexa/custom_modules<filename>src/jefalexaudf/__init__.py
import pandas as pd
import numpy as np
import datetime as dt
import os, sys
import re
import logging
import ipywidgets as widgets
from ipywidgets import interact, interact_manual, Button, Box, Layout, interactive, fixed, interact_manual
from IPython... | StarcoderdataPython |
3367633 | <gh_stars>1-10
import os
from modelmapper.ui import get_user_choice, get_user_input, YES_NO_CHOICES, split_user_input
from modelmapper.misc import _validate_file_has_start_and_end_lines, load_toml, write_settings
from modelmapper.base import OVERRIDES_FILE_NAME
TRAINING_CSV_MSG = """
Please provide the relative path t... | StarcoderdataPython |
3258042 | <gh_stars>1-10
"""Tests for our `watches cluster_health` subcommand."""
import json
from subprocess import PIPE, Popen as popen
from secure_support import TestSecureSupport
from watches.util import ESClientProducer
from six import string_types
class TestClusterHealth(TestSecureSupport):
username_password = ['--... | StarcoderdataPython |
97440 | """clean-room implementation of a mysql client supporting both *connect* and *quit* operations"""
import datetime
import socket
import struct
import sys
import time
from hashlib import sha1
from . import compat
import tornado.gen
import tornado.iostream
def _sxor(lhs, rhs):
if sys.version_info > (3, 0):
... | StarcoderdataPython |
4833304 | <reponame>lanthias/bson-numpy
import argparse
import collections
import math
import string
import sys
import timeit
from functools import partial
import pymongo
import numpy as np
from bson import BSON, CodecOptions, Int64, ObjectId
from bson.raw_bson import RawBSONDocument
try:
import bsonnumpy
except (ImportErr... | StarcoderdataPython |
1771863 | <reponame>Guzhongren/picuture2thumbnail
# -*- coding: utf-8 -*-
# Author:Guzhongren
# created: 2017-05-08
import os
filetype=[".JPG",".tif"]
folder_path = unicode(r"C:\geocon\解译样本(只提取jpg图片缩略图)", "utf8").encode("gbk")
jpg_count=0
tif_count=0
for parent, dirnames, filenames in os.walk(folder_path):
for filename in f... | StarcoderdataPython |
48946 | <reponame>DavidBuchanan314/rc4<filename>rc4/__init__.py
from .rc4 import RC4
| StarcoderdataPython |
3390323 | # coding: utf-8
"""
Copyright 2016 SmartBear Software
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 l... | StarcoderdataPython |
3377461 | <filename>process.py
from flask import Flask, render_template, request, jsonify, redirect, url_for
app = Flask(__name__)
@app.route('/')
def index():
message = 'Login'
return render_template('index.html', **locals())
@app.route('/form')
def form():
Description = 'Flask Ajax Practice'
return render_... | StarcoderdataPython |
1679646 | # -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: pyatv/mrp/protobuf/AudioFadeResponseMessage.proto
"""Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflectio... | StarcoderdataPython |
3238976 | <reponame>xuyu92327/waveform-analysis
import tables
import h5py
import numpy as np
class AnswerData(tables.IsDescription):
EventID = tables.Int64Col(pos=0)
ChannelID = tables.Int16Col(pos=1)
PETime = tables.Int16Col(pos=2)
Weight = tables.Float32Col(pos=3)
# Create the output file and the ... | StarcoderdataPython |
102438 | '''
'''
#
# Adapted from MATLAB code written by <NAME> (see Nishimoto, et al., 2011).
# <NAME> (Jan, 2016)
#
# Updates:
# <NAME> (Apr, 2020)
#
import itertools
from PIL import Image
import numpy as np
from moten.utils import (DotDict,
iterator_func,
log_compress,
... | StarcoderdataPython |
4826305 | <reponame>davehowell/sqlfluff
# No docstring here as it would appear in the rules docs.
# Rule definitions for the standard ruleset, dynamically imported from the directory.
# noqa
import os
from importlib import import_module
from glob import glob
# All rule files are expected in the format of L*.py
rules_path = os.... | StarcoderdataPython |
3254035 | import math
import random
import time
from roman import Robot, Tool, Joints
from roman.sim.simenv import SimEnv
class Writer():
def __init__(self):
self.frames = []
self.last_time = 0
def __call__(self, arm_state, hand_state, arm_cmd, hand_cmd):
if arm_state.time() - self.last_time < 0... | StarcoderdataPython |
3327947 | #import python imports
import csv
import os
#read the csv and convert into a list
with open('Resources/budget_data.csv') as csvfile:
data_reader = csv.reader(csvfile)
#read the header
header = next(data_reader)
data = list(data_reader)
#calculate the total numbr of months
months = len(data)
#calculat... | StarcoderdataPython |
1701656 | import numpy as np
from numpy.core.fromnumeric import size
from scipy.ndimage import affine_transform
from .._transform import Transformer
class Resize(Transformer):
def __init__(self) -> None:
super().__init__()
def transform_matric(self, scale):
assert len(scale) == 2, f'len(sclae) = {len(s... | StarcoderdataPython |
4810457 | # for dot acess
# arg = {'name': 'jojonki', age: 100}
# conf = Config(**arg)
# print(conf.name) ==> 'jojonki'
class Config(object):
def __init__(self, **entries):
self.__dict__.update(entries)
| StarcoderdataPython |
1797531 | <filename>images_api/app.py<gh_stars>0
from images_api import create_app
if __name__ == '__main__':
api = create_app()
api.run(host="0.0.0.0", debug=api.config['DEBUG'], port=api.config['FLASK_PORT'])
| StarcoderdataPython |
1704919 | '''
Script to generate embeddings from resnet trained using pcl
Command to run:
python eval_kmeans.py --pretrained experiment_pcl_resume/checkpoint.pth.tar /home/mprabhud/dataset/shapenet_renders/npys/
'''
from __future__ import print_function
import os
import sys
import time
import torch
import torch.nn as nn
impo... | StarcoderdataPython |
1775319 | from typing import Callable, Generic, Dict, List, TypeVar, Type
from .fnode import FNode
Request = TypeVar('Request')
Response = TypeVar('Response')
Value = TypeVar('Value')
class Flow(Generic[Value]):
def __init__(self):
self.start_node = None
self.nodes: Dict[str, FNode] = {}
def configure... | StarcoderdataPython |
44249 | <reponame>Xiul109/eeglib
import unittest
import numpy as np
from itertools import product
import eeglib.auxFunctions as aux
class TestAuxFuncs(unittest.TestCase):
dictToFlat = {"asd":1, "lol":[2,3], "var":{"xd":4, "XD":5}}
listToFlat = [0, 1, 2, [3, 4], [5, [6, 7]]]
simpleDict = {"a":0, "b":1}
... | StarcoderdataPython |
122794 | import numpy as np
from pyriemann.estimation import Covariances
from pyriemann.spatialfilters import CSP
from sklearn.feature_selection import SelectKBest, mutual_info_classif
from sklearn.model_selection import GridSearchCV
from sklearn.pipeline import make_pipeline
from sklearn.svm import SVC
from moabb.pipelines.ut... | StarcoderdataPython |
3233675 | from typing import BinaryIO
from nbt.classes.base import NBTBase, NBTPrimitiveFloat, NBTPrimitiveInt
class NBTTagEnd(NBTBase):
def write(self, data_stream: BinaryIO) -> None:
pass
@classmethod
def read(cls, data_stream: BinaryIO, depth: int) -> 'NBTBase':
return cls()
@classmethod
... | StarcoderdataPython |
3246574 | ''' Copyright [2018] [<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
https://github.com/Robosid/Drone-Intelligence/blob/master/License.pdf
https://github.com/Robosid/Dro... | StarcoderdataPython |
3369816 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import unittest
import epitran
class TestArabic(unittest.TestCase):
def setUp(self):
self.epi = epitran.Epitran('ara-Arab')
def test_Iraq(self):
tr = self.epi.transliterate('العراق')
self.assertEqual(tr, 'alʕraːq')
... | StarcoderdataPython |
3227568 | <reponame>delitamakanda/cautious-journey
"""backend URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.0/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path... | StarcoderdataPython |
1646738 | <reponame>FabianGroeger96/hslu-roblab-hs18
#!/usr/bin/env python
# Class autogenerated from /home/sam/Downloads/aldebaran_sw/nao/naoqi-sdk-2.1.4.13-linux64/include/alproxies/alchestbuttonproxy.h
# by <NAME>'s <Sammy.Pfeiffer at student.<EMAIL>.<EMAIL>.au> generator
# You need an ALBroker running
from naoqi import ALPr... | StarcoderdataPython |
159567 | # -*- coding: utf-8 -*-
# Copyright (c) 2019 <NAME>
# wwdtm_scoreimage is relased under the terms of the Apache License 2.0
"""Generate PNG image file based on WWDTM show score totals"""
import json
import math
import os
from typing import List
import mysql.connector
from mysql.connector.errors import DatabaseError, P... | StarcoderdataPython |
3395624 | <reponame>opendatacube/datacube-zarr<filename>integration_tests/conftest.py
# coding=utf-8
"""
Common methods for index integration tests.
"""
import itertools
import multiprocessing
import os
import re
from pathlib import Path
from time import sleep
import pytest
import boto3
import datacube.scripts.cli_app
import da... | StarcoderdataPython |
134146 | <filename>django_ltree_field/migrations/0001_initial.py
# Generated by Django 3.1.7 on 2021-03-29 01:59
from django.db import migrations
import django.contrib.postgres.operations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
django.contrib.postgres.operations.CreateEx... | StarcoderdataPython |
3253174 | <filename>semDiff/coverage.py<gh_stars>1-10
class Coverage:
"""
A class that compute the overlap between two structures
"""
jsonld_ignored_keys = ["@id", "@context", "@type"]
@staticmethod
def json_schema_context_coverage(schema, context):
""" Static method to compute the coverage of... | StarcoderdataPython |
1705049 | <filename>email form/react.py
// Customize this 'myform.js' script and add it to your JS bundle.
// Then import it with 'import MyForm from "./myform.js"'.
// Finally, add a <MyForm/> element whereever you wish to display the form.
import React from "react";
export default class MyForm extends React.Component {... | StarcoderdataPython |
3399876 | <filename>homeassistant/components/blovee/dtos.py<gh_stars>0
from attr import dataclass
@dataclass
class BloveeDevice:
name: str
model: str
mac: str
err: str
is_on: bool
brightness: int
| StarcoderdataPython |
51556 | <reponame>stefantaubert/life<gh_stars>1-10
import os
from geo.data_paths import get_suffix_pro
from geo.data_paths import get_suffix_prote
from geo.data_paths import get_suffix_o
from geo.data_dir_config import root
analysis_dir = root + "analysis/"
heatmaps_dir = root + "analysis/Heatmaps/"
most_common_values_best_... | StarcoderdataPython |
1651646 | <gh_stars>0
import random
import os
import sys
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '../../..')))
from app.app.entities.shuttle import Shuttle
from app.app.routing.graph import Graph
from app.app.entities.models.battery_model import BatteryModel
from app.app.entities.models.velocit... | StarcoderdataPython |
4808976 | <filename>sneruz/errors.py
class Error(Exception):
"""Base class for exceptions in this module"""
class TruthAssignmentError(Error):
"""Raised when a deduction is attempted with no truth assignment"""
class TableFormatError(Error):
"""Raised when a inconsistency in table size/shape is present""" | StarcoderdataPython |
3209175 | import os
import os.path
from subprocess import Popen, PIPE
import h5py
import numpy as np
import pytopkapi
def show_banner(ini_file, nb_cell, nb_time_step):
"""Show an ASCII banner at run time describing the model.
Parameters
----------
ini_file : str
The name of the PyTOPKAPI initializatio... | StarcoderdataPython |
3316400 | <reponame>atr00025/ML_Image_classification_with_Tensorflow<filename>cat-vs-dog.py<gh_stars>0
import os
import zipfile
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
from tensorflow.keras import layers
from tensorflow.keras import Model
from tensorflow.keras.optimizers import SGD
from tensorflow... | StarcoderdataPython |
3621 | <reponame>ehiller/mobilecsp-v18<filename>modules/courses/courses.py
# Copyright 2012 Google Inc. 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.apach... | StarcoderdataPython |
3383930 | from django.test import RequestFactory
from manager.api.views.docs import schema_view
def run(to):
response = schema_view(RequestFactory().get("/api/schema"))
response.render()
with open(to, "wb") as file:
file.write(response.content)
| StarcoderdataPython |
163026 | <reponame>iKsSs/sslsplit<filename>extra/logreader.py
#!/usr/bin/env python
# vim: set ft=python list et ts=8 sts=4 sw=4:
# SSLsplit contributed code: Log parser for sslsplit -L
# This script reads the log from standard input and parses it.
# Standard input can point to a file or a named pipe.
# Copyright (C) 2015, <... | StarcoderdataPython |
1714049 | <reponame>mvirkkunen/dwprog<filename>generatedevices.py<gh_stars>10-100
#!/usr/bin/env python3
# converts Atmel device files into devices.py
from xml.etree import ElementTree
from fnmatch import fnmatch
from zipfile import ZipFile
import sys
spmcsr_bits = {
0x01: ["SPMEN", "SELFPRGEN"],
0x02: ["PGERS"],
... | StarcoderdataPython |
1756291 | import shutil
import time
SECONDS_IN_HOUR = 3600
SECONDS_IN_MINUTE = 60
SHORTEST_AMOUNT_OF_TIME = 0
class InvalidTimeParameterError(Exception):
pass
def _get_delay_time(session):
"""
Helper function to extract the delay time from the session.
:param session: Pytest session object.
:return: Ret... | StarcoderdataPython |
3335974 | <reponame>paultag/billy<filename>billy/reports/legislators.py
from collections import defaultdict
from billy.core import db
from billy.core import settings
from billy.reports.utils import update_common
# semi-optional keys to check for on active legislators
checked_keys = ('photo_url', 'url', 'email', 'transparencyda... | StarcoderdataPython |
3395205 | <filename>hojehatransportes/social_auth_extra/sapo.py
"""
SAPO OAuth support.
This adds support for SAPO OAuth service. An application must
be registered first on twitter and the settings SAPO_CONSUMER_KEY
and SAPO_CONSUMER_SECRET must be defined with they corresponding
values.
User screen name is used to generate us... | StarcoderdataPython |
3309526 | <reponame>AlgTUDelft/ExpensiveOptimBenchmark
from .base import BaseProblem
import os.path
import numpy as np
import tsplib95
import networkx
class TSP(BaseProblem):
def __init__(self, name, W, n_iter, noise_seed=None, noise_factor=1):
self.name = name
self.d = W.shape[0] - 2
self.W = W
... | StarcoderdataPython |
60572 | import pathlib
from setuptools import setup, find_packages
from pokemontcgsdkasync.config import __version__, __pypi_package_name__, __github_username__, __github_repo_name__
# The directory containing this file
HERE = pathlib.Path(__file__).parent
# The text of the README file
README = (HERE / "README.md").read_te... | StarcoderdataPython |
67934 | <gh_stars>0
# Generated by Django 3.1.7 on 2021-03-24 16:17
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('employee_information_site', '0008_auto_20210324_2116'),
]
operations = [
migrations.AlterModelOptions(
name='employee',
... | StarcoderdataPython |
189541 | # HEAD
# Classes - Metaclasses for class modification
# DESCRIPTION
# Describes how to use metaclasses dynamically to modify classes during instatiation
# Describes how to add attributes to a metaclass
# or re-implement the type __call__ methods
# Public
# RESOURCES
#
# /opt/pycharm/pycharm-community-2019.2.... | StarcoderdataPython |
9460 | <filename>arc113/b.py
# included from snippets/main.py
def debug(*x, msg=""):
import sys
print(msg, *x, file=sys.stderr)
def solve(SOLVE_PARAMS):
pass
def main():
A, B, C = map(int, input().split())
doubling = [B % 20]
for i in range(32):
doubling.append(
(doubling[-1] **... | StarcoderdataPython |
3247153 | <gh_stars>100-1000
#! /usr/bin/env python
# -*- coding: UTF-8 -*-
"""
$ ~/anaconda3/bin/python eval_pred.py --evaluate --checkpoint_dir="./runs/1523240176/checkpoints/"
$ ~/anaconda3/bin/python eval_pred.py --predict --checkpoint_dir="./runs/1523240176/checkpoints/"
"""
import numpy as np
import pandas as pd
import o... | StarcoderdataPython |
3389445 | <reponame>Loodos/zemberek-python
class TurkicLetter:
"""
This class represents a Letter which contains Turkic language specific attributes, such as vowel type,
English equivalent characters.
"""
UNDEFINED: 'TurkicLetter'
def __init__(self, char_value: str = False, vowel: bool = False, frontal: ... | StarcoderdataPython |
1693156 | from movies import movie_dataset, movie_ratings
# Euclydian distance
def distance(movie1, movie2):
squared_difference = 0
for i in range(len(movie1)):
squared_difference += (movie1[i] - movie2[i]) ** 2
final_distance = squared_difference ** 0.5
return final_distance
# Get "K" closest titles (from "unknown... | StarcoderdataPython |
478 | <gh_stars>0
import argparse
import imageio
import progressbar
from _routines import ffi, lib
from pylab import *
from random import Random
RESOLUTIONS = {
"2160p": (3840, 2160),
"1440p": (2560, 1440),
"1080p": (1920, 1080),
"720p": (1280, 720),
"480p": (854, 480),
"360p": (640, 360),
"240p"... | StarcoderdataPython |
1606270 | <reponame>cookejames/uibbq
"""Micropython iBBQ Interface"""
__version__ = "1.0"
from struct import unpack_from
import uasyncio as asyncio
import bluetooth
import aioble
class iBBQ:
_DEVICE_NAME = "iBBQ"
_PRIMARY_SERVICE = bluetooth.UUID(0xFFF0)
_ACCOUNT_AND_VERIFY_CHARACTERISTIC = bluetooth.UUID(0xFFF2... | StarcoderdataPython |
9274 | # -*- coding: utf-8 -*-
# Copyright (c) Vispy Development Team. All Rights Reserved.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
import numpy as np
from os import path as op
from ..util import load_data_file
# This is the package data dir, not the dir for config, etc.
DATA_DIR = op.join... | StarcoderdataPython |
19458 | """
From http://jimorlin.wordpress.com/2009/02/17/colored-letters-labeled-dice-a-logic-puzzle/
There are 13 words as follows: buoy, cave, celt, flub, fork, hemp, judy, junk, limn, quip, swag, visa.
There are 24 different letters that appear in the 13 words.
The question is: can one assign the 24 letters to 4 different ... | StarcoderdataPython |
1775115 | #input data:
#```
#NZ_AFRW01000000.gbk:WGS AFRW01000001-AFRW01000138
#NZ_AFUK01000000.gbk:WGS AFUK01000001
#NZ_AFUR01000000.gbk:WGS AFUR01000001-AFUR01000007
#```
import os
import sys
from Bio import Entrez
for lines in open(sys.argv[1], 'rU'):
line = lines.strip().split()
ncbi_org_acc = lin... | StarcoderdataPython |
1730325 | # Copyright (c) 2020-2021 CRS4
#
# 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, merge, publish, distribut... | StarcoderdataPython |
101874 | <filename>mitosis/async_node/async_node.py<gh_stars>1-10
import logging
from contextlib import AsyncExitStack
from typing import Any, Callable, Optional
from anyio import (
TASK_STATUS_IGNORED,
BrokenResourceError,
CancelScope,
ClosedResourceError,
Event,
WouldBlock,
current_effective_deadl... | StarcoderdataPython |
1787244 | <reponame>nuagenetworks/nuage-tempest-plugin<gh_stars>1-10
# Copyright 2012 OpenStack Foundation
# Copyright 2013 Hewlett-Packard Development Company, L.P.
# 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. ... | StarcoderdataPython |
3240954 | <reponame>carlos-moreno/curso-de-selenium
# print <- Função que escreve na tela, quando chamada
# print('Oi, meu nome é Carlos')
idade = input('Qual o seu idade? ')
print(idade)
| StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.