id
stringlengths
1
265
text
stringlengths
6
5.19M
dataset_id
stringclasses
7 values
50322
""" Full Text Search Framework """ from django.db import models from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes import generic from fts.settings import * if FTS_BACKEND.startswith('simple://'): class IndexWord(models.Model): word = models.CharField(uniq...
StarcoderdataPython
4819894
import os import pandas as pd import requests import mixpanel as mp MIXPANEL_API_KEY = os.environ.get('MIXPANEL_API_KEY') MIXPANEL_API_SECRET = os.environ.get('MIXPANEL_API_SECRET') keys = (MIXPANEL_API_KEY, MIXPANEL_API_SECRET) DATA_LOCATION = './data/ppe-responses.csv' HOSPITALS_LOCATION = './data/hospital_location...
StarcoderdataPython
3231503
# ------------------------------------------------------------------------------ # Program: The LDAR Simulator (LDAR-Sim) # File: methods.deployment.stationary_crew # Purpose: Stationary crew specific deployment classes and methods (ie. Scheduling) # # Copyright (C) 2018-2021 <NAME>, <NAME>, <NAME>, <NA...
StarcoderdataPython
3361551
<gh_stars>10-100 import hashlib import os import pathlib import shutil import tempfile from functools import partial from pathlib import Path, PurePath from typing import Mapping, Union from .. import humanize from ..core.base import AbstractNestedEntity, ExecutorEntity from ..core.formatter import FormattedEntity fro...
StarcoderdataPython
34510
<filename>cdc/src/__init__.py from NoteDeid import * from NoteConceptParser import * from Converter import * from D2v import * from MLPipeline import *
StarcoderdataPython
79467
<filename>app/migrations/0019_auto_20210206_1309.py # Generated by Django 3.1.4 on 2021-02-06 12:09 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("app", "0018_auto_20210206_0402"), ] operations = [ migrations.AlterField( mo...
StarcoderdataPython
4838934
# -*- coding: utf-8 -*- from __future__ import unicode_literals import array from collections import Mapping, defaultdict import numbers import re import unicodedata import nltk import numpy as np from numpy import bincount import scipy.sparse as sp def _make_int_array(): return array.array(str("i")) def _docum...
StarcoderdataPython
162744
"""Histogram for accurate skin detection in opencv."""
StarcoderdataPython
101991
<reponame>f0cal/f0cal.farm.client import os import sys import logging from conans.client.conan_api import Conan from conans.model.ref import ConanFileReference from conans.errors import ConanException import f0cal.core VENV_HOME = sys.prefix LOG = logging.getLogger(__name__) CONAN_REMOTE_NAME = 'f0cal_images' CONAN...
StarcoderdataPython
4833816
#!/usr/bin/env python3 # classes for database reporting # ONE CLASS PER TABLE?? IS THAT A GOOD IDEA?? import os import sys # local modules try: import MySQLqueries import pymmFunctions except: from . import MySQLqueries from . import pymmFunctions class EventInsert: ''' gather variables do the thing (make the...
StarcoderdataPython
3262661
#!/usr/bin/env python # -*- coding:utf-8 -*- from setuptools import setup setup( name="alipesa_tornado", version='1.0.0', description="Tornado Framework", long_description="", classifiers=[], author="<NAME>", url="https://github.com/alipsgh/tornado", license="MIT", packages=["...
StarcoderdataPython
3329000
<filename>20191217.py<gh_stars>1-10 # import matplotlib. pyplot as plt # input_values = [1, 2, 3, 4, 5] # squares = [1, 4, 9, 16, 25] # plt.plot(input_values, squares, linewidth = 5) # plt.title(" Square Numbers", fontsize= 24) # plt.xlabel(" Value", fontsize= 14) # plt.ylabel(" Square of Value",fontsize= 14) # plt.tic...
StarcoderdataPython
1675806
#!/usr/bin/env python # -*- coding: utf-8 -*- # SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: © 2021 Massachusetts Institute of Technology. # SPDX-FileCopyrightText: © 2021 <NAME> <<EMAIL>> # NOTICE: authors should document their contributions in concisely in NOTICE # with details inline in source files...
StarcoderdataPython
3346927
<filename>test/test_ude/side_channels/adapters/test_dummy_side_channel.py<gh_stars>0 ################################################################################# # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # # ...
StarcoderdataPython
1784008
<filename>evaluate_retrieval.py import numpy as np import numexpr as ne import argparse, pickle, os.path from collections import OrderedDict from datasets import get_data_generator from class_hierarchy import ClassHierarchy try: from tqdm import tqdm except ImportError: def tqdm(it, **kwargs): ...
StarcoderdataPython
3390352
<filename>MSKHackMAG/result.py class Result: def __init__(self, result="", error="", ): self.resut = result self.error = error def as_response(self): if self.resut: return "{" + """ "result": {}, "errorMessage": "" """.format(self.resut,...
StarcoderdataPython
61385
<gh_stars>0 FULL_SCREEN = "FULL_SCREEN" MOVE_UP = "MOVE_UP" MOVE_LEFT = "MOVE_LEFT" MOVE_RIGHT = "MOVE_RIGHT" MOVE_DOWN = "MOVE_DOWN" ATTACK = "ATTACK" INVENTORY = "INVENTORY" MOVEMENT_ACTION = [ MOVE_DOWN, MOVE_UP, MOVE_RIGHT, MOVE_LEFT, ]
StarcoderdataPython
3200556
<reponame>florida-open-data/smh-coovid-data #!/usr/bin/env python3 import os,sys,glob #files = glob.glob('2021????/*') files = glob.glob('2021????/*') print('files=', len(files)) for f in files: dname = os.path.dirname(f) dr = dname[:6] ndir = dname[:6] +'/'+ dname[6:8] base = os.path.basename(f) ...
StarcoderdataPython
116541
<reponame>Dmendoza3/Phyton def longestWord(sentence): wordArray = sentence.split(" ") longest = "" for word in wordArray: if(len(word) >= len(longest)): longest = word return longest print(longestWord("Hello World"))
StarcoderdataPython
35832
<gh_stars>0 from typing import Generic, List, Optional, Type, TypeVar, Union, Dict, Any from uuid import UUID from fastapi import HTTPException from fastapi.encoders import jsonable_encoder from pydantic import BaseModel from sqlalchemy.orm import Session from src.db.sqlalchemy.database import Base ModelType = TypeV...
StarcoderdataPython
61205
<reponame>kurik/scripts #!/usr/bin/env python # -*- coding: utf-8 -*- import apiclient import oauth2client from oauth2client import tools from oauth2client.file import Storage from apiclient import discovery import httplib2 import oauth2client import os import ItemCache try: import argparse flags = argparse.A...
StarcoderdataPython
161765
# coding: utf-8 from __future__ import absolute_import from datetime import date, datetime # noqa: F401 from typing import List, Dict # noqa: F401 from jobbing.models.base_model_ import Model from jobbing import util class ServiceProvided(Model): """NOTE: This class is auto generated by the swagger code gene...
StarcoderdataPython
3275944
# -*- coding: utf-8 -*- # # Copyright (C) 2008-2013 <NAME> <<EMAIL>> # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. # import os.path import shutil import tempfile import unittest from trac.core import * from trac.te...
StarcoderdataPython
1702732
from typing import List import pandas as pd from pyjackson.core import ArgList, Field from pyjackson.decorators import cached_property from ebonite.core.analyzer.base import TypeHookMixin from ebonite.core.analyzer.dataset import DatasetHook from ebonite.core.objects.dataset_type import DatasetType class PandasHook...
StarcoderdataPython
1662218
import asyncio import datetime import itertools import sys import logs from jj2 import GameClient from jj2.connection import Lookup from jj2.utils import remove_markup class LoggerBot(GameClient): log_id = len(list(logs.PATH.glob(r'chatlog-*.txt'))) default_streams = (sys.stdout, open(f'../logs/chatlog-{str(...
StarcoderdataPython
3256343
<reponame>shutingrz/cheers import hmac, hashlib, string, secrets class Util(): MaxUserIdLength = 64 MaxUserPassLength = 64 DefaultStockValue = 100 InfiniteMode = True DebugMode = True @classmethod def generateRandomBytes(self, length, seq=string.digits + string.ascii_lowercase): rand_str = ''.join(secrets....
StarcoderdataPython
1769058
#!/usr/bin/python # ocrdv - reads frames from a .dv untill it finds a bunch of words import subprocess import optparse import pyffmpeg # http://code.google.com/p/pyffmpeg/issues/detail?id=9#c4 from io import StringIO from csv import DictReader from collections import defaultdict titwords = None dictionary = None ...
StarcoderdataPython
145860
<filename>src/pyt2ga/core.py import pandas as pd import numpy as np import json from scipy.stats import chi2 from numpy import linalg as la import multiprocessing def nearestPD(A): """Find the positive-definite matrix nearest to input. Written by <NAME>: https://stackoverflow.com/users/500207/ahmed-fasih...
StarcoderdataPython
4809823
<reponame>CognitiveComputationLab/orca """ CCOBRA data container. """ import copy import logging from . import convert_to_basic_types from .item import Item # Initialize module-level logger logger = logging.getLogger(__name__) class CCobraData(): """ CCobra experimental data container. """ def __init...
StarcoderdataPython
117890
<filename>kinto_algolia/views.py import json import logging from algoliasearch.exceptions import AlgoliaException from kinto.core import authorization from kinto.core import Service from kinto.core import utils from kinto.core.errors import raise_invalid logger = logging.getLogger(__name__) class RouteFactory(auth...
StarcoderdataPython
1721904
<filename>tests/test_env.py import pytest from dstools.env.env import _get_name, Env def test_can_create_env_from_dict(cleanup_env): e = Env.from_dict({'a': 1}) assert e.a == 1 def test_assigns_default_name(): assert _get_name('path/to/env.yaml') == 'root' def test_can_extract_name(): assert _get_...
StarcoderdataPython
3243358
class Statement(object): def __init__(self, i_name = ''): self.name = i_name self.startingPoint = 0 self.comment = None self.value = None self.path = '' self._parentPath = '' self.parent = None # Parent statement, can only be a group statement def __lt__...
StarcoderdataPython
1638509
from redbot.core.bot import Red from .mod import Mod async def setup(bot: Red): cog = Mod(bot) bot.add_cog(cog) await cog.initialize()
StarcoderdataPython
187136
<reponame>esoadamo/simple-guardian-ad-hoc from typing import NamedTuple, Set from lib import LogRule, IPBlocker, LogFile class AppProfile(NamedTuple): profile_name: str log: LogFile blocker: IPBlocker rules: Set[LogRule]
StarcoderdataPython
3316229
import argparse import os import json import logging import pandas as pd import numpy as np import matplotlib.pyplot as plt from matplotlib import rcParams from utils import bd from glob import glob rcParams['axes.labelsize'] = 20 rcParams['xtick.labelsize'] = 20 rcParams['ytick.labelsize'] = 20 rcParams['legend.fonts...
StarcoderdataPython
1674994
<filename>contextlab/layers/gcnet/gcnet.py ''' @Description: GCNet file from the MSRA @Author: <NAME> @Email: <EMAIL> @Date: 2019-08-15 10:20:38 @LastEditors: <NAME> @LastEditTime: 2019-09-27 18:40:35 ''' import torch from torch import nn # from mmcv.cnn import constant_init, kaiming_init from contextlab.utils.weight_...
StarcoderdataPython
4838890
__all__ = ["S3BucketPublicReadAclAndListStatementRule", "S3BucketPublicReadWriteAclRule"] import logging import re from typing import Dict, Optional from pycfmodel.model.cf_model import CFModel from pycfmodel.model.resources.s3_bucket_policy import S3BucketPolicy from cfripper.model.enums import RuleGranularity, Rul...
StarcoderdataPython
1642417
#iz kazala bomo pobrali url-je strani ki nas zanimajo import re with open('kazalo') as f: vsebina = f.read() r"https://www.hofer.si/sl/posebna-ponudba/od-ponedeljka-8-11-2021/" vzorec = ( r'<a href="/title/tt' r'(?P<id>\d{7})' # ID ima sedem števk r'/\?ref_=adv_li_tt"\n>' # neka šara vmes med id-jem ...
StarcoderdataPython
1788408
<reponame>ACIL-Group/DVHA<filename>src/processing/reorder_datasets.py """ Copyright 2019 <NAME> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LIC...
StarcoderdataPython
1762710
# -*- coding: utf-8 -*- from __future__ import print_function, division import os import sys from pymic.util.parse_config import parse_config from pymic.net_run.agent_seg import SegmentationAgent from path_config import path_dict def main(): if(len(sys.argv) < 4): print('Number of arguments should be 4. e....
StarcoderdataPython
47925
# -*- coding: utf-8 -*- """ #The following formula is used #Adjusted Volume = Raw Volume - Regression Slope * (TIV - Cohort Mean TIV) #Reference Literature: Voevodskaya et al, 2014: The effects of intracranial volume adjustment approaches on multiple regional MRI volumes in healthy aging and Alzheimer's disease """ i...
StarcoderdataPython
1757440
<reponame>Pedroglp/kanban from django.db import models from django.contrib.auth.models import User from django.utils import timezone class Status(models.Model): name = models.CharField(max_length = 255, blank = False, null = False) description = models.CharField(max_length = 255, blank = True, null = False) ...
StarcoderdataPython
1629828
<reponame>Dans-labs/clariah-dr<filename>programs/legacy/analyse.py import collections import re from config import Config C = Config() SOURCE = f"{C.local}/{C.name}_chocr.html" DEST = f"{C.local}/{C.name}_divs.txt" elemClassRe = re.compile(r'''^<(\S+) class="([^"]*)''') elems = collections.Counter() with open(SO...
StarcoderdataPython
126653
<filename>tests/pytest/test_nj_all_noise.py # standard libraries import json # third party libraries import pytest import tqdm # project libraries from speech import dataset_info from speech.utils.wave import array_from_wave from speech.utils.signal_augment import audio_with_sox import utils def test_main(): ...
StarcoderdataPython
39259
# Given an integer array arr, count element x such that x + 1 is also in arr. # If there're duplicates in arr, count them seperately. # Example 1: # Input: arr = [1,2,3] # Output: 2 # Explanation: 1 and 2 are counted cause 2 and 3 are in arr. # Example 2: # Input: arr = [1,1,3,3,5,5,7,7] # Output: 0 # Explanatio...
StarcoderdataPython
3352975
# Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. # # Use of this source code is governed by a BSD-style license # that can be found in the LICENSE file in the root of the source # tree. An additional intellectual property rights grant can be found # in the file PATENTS. All contributing project au...
StarcoderdataPython
1608676
"""Module to initialise the navigation app migrations folder."""
StarcoderdataPython
3229045
<reponame>rwbogl/GerryChain import json import geopandas from ..graph import Graph from ..updaters import compute_edge_flows, flows_from_changes from .assignment import get_assignment from .subgraphs import SubgraphView class Partition: """ Partition represents a partition of the nodes of the graph. It will...
StarcoderdataPython
1778122
#!/usr/bin/python3 # A small OCR demo. To install pytesseract: # sudo apt install -y tesseract-ocr libtesseract-dev # pip3 install pytesseract from picamera2 import Picamera2, Preview, MappedArray import pytesseract import cv2 from pprint import pprint picam2 = Picamera2() picam2.configure(picam2.preview_configurati...
StarcoderdataPython
122871
<filename>tests/utils.py from pywps import get_ElementMakerForVersion import xarray as xr from owslib.wps import WPSExecution from pywps.tests import assert_response_success VERSION = "1.0.0" WPS, OWS = get_ElementMakerForVersion(VERSION) def wps_input_file(identifier, filename): return WPS.Input( OWS....
StarcoderdataPython
4828265
# Copyright (c) 2013, wayzon and contributors # For license information, please see license.txt from __future__ import unicode_literals import frappe from frappe.model.document import Document class OrderGeneration(Document): pass @frappe.whitelist() def show_table(d): q=frappe.db.sql("""select table_no from `tabT...
StarcoderdataPython
1761053
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Preprocesses, analyzes, and plots an entire directory of Session folders Requirements – CSV files that have been restructed via ProcessRCS() JSON->MAT->CSV these files can be created in bulk using processrcs_wrapper() example ls -d1 $PWD/Session*/DeviceNPC**/ > /User...
StarcoderdataPython
106647
import RPi.GPIO as GPIO import time try: # GPIO.setmode(GPIO.BOARD) # ButtonPin = 7 # LedPin = 8 GPIO.setmode(GPIO.BCM) ButtonPin = 4 LedPin = 14 GPIO.setup(ButtonPin, GPIO.IN, pull_up_down=GPIO.PUD_DOWN) GPIO.setup(LedPin, GPIO.OUT) for i in range(0,4): state = GPIO.input(ButtonPin) print(state) if...
StarcoderdataPython
3284238
<filename>qiskit/providers/aer/extensions/snapshot.py # This code is part of Qiskit. # # (C) Copyright IBM 2018, 2019. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/...
StarcoderdataPython
1771118
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. from maro.utils.exception import ERROR_CODE class MAROException(Exception): """ Base exception class for MARO errors in Python. Args: error_code (int): the MARO error code defined in error code. e.g. 1000-1999: fo...
StarcoderdataPython
1668475
<gh_stars>1-10 # -*- coding: utf-8 -*- # Filename: demo_dmu380_sim.py """ An inclinometer demo. Created on 2018-03-16 @author: dongxiaoguang """ import os import math import numpy as np from gnss_ins_sim.sim import imu_model from gnss_ins_sim.sim import ins_sim # globals D2R = math.pi/180.0 motion_def_path = os.pat...
StarcoderdataPython
1711897
<filename>tests/test_classes.py # !/usr/bin/env python3 """ Test suite for classes. """ import pytest import difflib from abc import ABC from pathlib import Path from tempfile import TemporaryFile from cblaster import classes TEST_DIR = Path(__file__).resolve().parent DATA_DIR = TEST_DIR / "data" # HIT TESTS @py...
StarcoderdataPython
190441
# Generated by Django 2.2.3 on 2019-07-03 21:34 from django.db import migrations, models import django.db.models.deletion import django.utils.timezone class Migration(migrations.Migration): dependencies = [ ('ticket_app', '0001_initial'), ] operations = [ migrations.AddField( ...
StarcoderdataPython
24816
# coding: utf-8 """ Engine api Engine APIs # noqa: E501 The version of the OpenAPI document: 1.0.4 Generated by: https://openapi-generator.tech """ import pprint import re # noqa: F401 import six class EngineTask(object): """NOTE: This class is auto generated by OpenAPI Generator. Ref:...
StarcoderdataPython
56393
from sklearn.preprocessing import scale import numpy as np class GradientDescent: learning_rate = 0.01 max_iter = 2000 scale = False new_theta = [] def __init__(self, learning_rate=0.01, max_iter=2000, scale=False): self.learning_rate = learning_rate self.max_ite...
StarcoderdataPython
1613652
#!/usr/bin/env python3 from http.server import SimpleHTTPRequestHandler, test import argparse class InlineHandler(SimpleHTTPRequestHandler): def end_headers(self): mimetype = self.guess_type(self.path) is_file = not self.path.endswith('/') # is_file = True # This part adds extra ...
StarcoderdataPython
1689980
<filename>safe_filefield/tests/test_validators.py import os from unittest.mock import Mock import clamd import pytest from django.core.exceptions import ValidationError from django.test import override_settings from safe_filefield import clamav from .utils import get_extras_file, get_uploaded_file from ..validators i...
StarcoderdataPython
3264821
<filename>src/client_server_interface.py import requests ''' Interface class is the border of the system Maybe refactored out in the future, and incorporated into client_controller @Author <NAME> ''' class Interface: def __init__(self): self._tmp = '' ''' Forwards a message to server @Author <NAME> '''...
StarcoderdataPython
193200
<gh_stars>1-10 # Copyright: (c) OpenSpug Organization. https://github.com/openspug/spug # Copyright: (c) <<EMAIL>> # Released under the MIT License. from django.core.management.base import BaseCommand from django.core.management import execute_from_command_line from django.conf import settings class Command(BaseComma...
StarcoderdataPython
1632904
""" File used to instantiate the different extensions that we use in the application notice that we have not instantiated Flask-SQLAlchemy. We will do this in the db.py module. """ from flask_marshmallow import Marshmallow from flask_migrate import Migrate ma = Marshmallow() migrate = Migrate()
StarcoderdataPython
62824
class Point: def __init__(self, x, y): self.x = x self.y = y def __str__(self): return f'Точка: ({self.x}, {self.y})' def __add__(self, other): return Point(self.x + other.x, self.y + other.y) def distance(self): return (self.x ** 2 + self.y ** 2) ** 0.5 d...
StarcoderdataPython
3279954
<gh_stars>1-10 #Helpful for aligning the text with the English WEB Bible #Author: cwtliu numbers = [] curr_chap = 1 prev_verse = -1 curr_verse = 0 curr_count = 0 line_count = 0 #with open('OT_yupik_fix/30_AMO.txt.txt', 'r') as f: #with open('OT_yupik_fix/31_OBA.txt.txt', 'r') as f: #with open('OT_yupik_fix/32_JON.tx...
StarcoderdataPython
65177
""" Módulo com todos os tipos de propriedades do Movidesk. Exemplo de uso: >>> from datetime import datetime >>> from pyvidesk.tickets import Tickets >>> my_date = datetime(2020, 1, 1, 20, 0, 0) >>> tickets = Tickets(token="<PASSWORD>") >>> tickets_properties = tickets.get_properties() >>> print(tickets_properties["...
StarcoderdataPython
3295183
<gh_stars>1-10 # -*- coding: utf-8 -*- """ Created on Mon Nov 18 14:35:46 2019 @author: ymamo Adapted from Python for Engineers at pythonforengineers.com/analysing-the-enron-email-corpus/ """ import os from collections import Counter import time from email.parser import Parser import json ...
StarcoderdataPython
1731232
<reponame>DavidRother/elavpy import setuptools with open("README.md", "r") as fh: long_description = fh.read() setuptools.setup( name="evalpy", version="0.0.11", author="<NAME>", author_email="<EMAIL>", description="A lightweight framework for experiment logging and automatic visualization", ...
StarcoderdataPython
3335480
<gh_stars>0 import unittest class TestUser(unittest.TestCase): def test___repr__(self): # user = User() # self.assertEqual(expected, user.__repr__()) assert False # TODO: implement your test here def test___unicode__(self): # user = User() # self.assertEqual(expected...
StarcoderdataPython
25391
<reponame>hkchengrex/CharTrans-GAN from net import Net from font_loader import FontDataset import torch import torchvision import torchvision.transforms as transforms font_root = './data/test1/' std_font = './data/standard/' font_size = 52 image_size = 48 numTransform = 5 numRef = 5 char_list_path = './character_se...
StarcoderdataPython
3228427
from w4_tiled_converter import block_spawn from w4_tiled_converter.text_trigger import TextTriggers from w4_tiled_converter.block_spawn import BlockSpawns from w4_tiled_converter.image_layer import ImageLayer from w4_tiled_converter.data_layer import DataLayer import hashlib class TileMap: def __init__(self, nam...
StarcoderdataPython
4815914
"plot.py" from statistics import mean, median, stdev from matplotlib import pyplot as plt file = open("packages_time.txt", "r") pack_times = [] for val in file.read().split(): pack_times.append(int(val)) file.close() mean_value = mean(pack_times) min_value = min(pack_times) max_value = max(pack_times) median_val...
StarcoderdataPython
4805419
<reponame>not4YU5H/hacktoberfest2021-2 class Solution: def generate(self, numRows: int) -> List[List[int]]: # initializing triangle's 1st level res=[[1]] for i in range(1,numRows): n=len(res) # initializing array at level n to have length n row=[0]*(i+1) ...
StarcoderdataPython
3235478
<gh_stars>1-10 import json import logging import os import random import shlex import string import subprocess import sys import time import numpy as np from flask import Flask, request from werkzeug import secure_filename from celery import Celery logging.basicConfig(level=logging.DEBUG) app = Flask(__name__) app....
StarcoderdataPython
1662325
<reponame>bollwyvl/robotframework-tidy<gh_stars>0 import pytest from .. import TransformerAcceptanceTest class TestNormalizeSeparators(TransformerAcceptanceTest): TRANSFORMER_NAME = "NormalizeSeparators" def test_normalize_separators(self): self.compare(source="test.robot") def test_normalize_w...
StarcoderdataPython
4801976
<reponame>pmacosta/pplot<gh_stars>1-10 # plot_example_5.py # Copyright (c) 2013-2019 <NAME> # See LICENSE for details # pylint: disable=C0111,C0410,C0413,E0611,F0401,R0903 import sys, pmisc, pplot if sys.hexversion < 0x03000000: from pplot.compat2 import _write else: from pplot.compat3 import _write def wri...
StarcoderdataPython
183765
from enum import Enum, unique class BaseEnum(Enum): @classmethod def values(cls) -> list: """Returns a list of raw values for the class""" values = [member.value for role, member in cls.__members__.items()] return values @unique class Keys(BaseEnum): """Represents categories of ob...
StarcoderdataPython
74736
<gh_stars>100-1000 import logging import abc import datetime import traceback import urllib.parse import sqlalchemy.exc import common.database as db # import RawArchiver.TimedTriggers.RawRollingRewalkTrigger # def exposed_raw_rewalk_old(): # ''' # Trigger the rewalking system on the rawarchiver # ''' # run =...
StarcoderdataPython
1712459
import Queue import threading class DummyBus: def __init__(self): self.CMDqueue = Queue.Queue(1) # arbitrary commnad queue self.CMDdaemon = threading.Thread(target=self._issueRoutine, name='Command Issue Routine') self.CMDdaemon.setDaemon(True) self.CMDdaemon.start() sel...
StarcoderdataPython
3339873
# flake8: noqa from .impl import set_uuids, cached_isinstance, make_index, substitute_links, \ substitute_objects, flatten, recursive_foreach, recursive_flatmap, \ writable_sort_order __all__ = ["set_uuids", "cached_isinstance", "make_index", "substitute_links", "substitute_objects", "flatten", "rec...
StarcoderdataPython
1635111
<reponame>gcvalderrama/python_foundations import unittest class Node: def __init__(self): self.value = None self.right = None self.left = None def order(target): if not target: return order(target.left) print(target.value) order(target.right) def pre_order(...
StarcoderdataPython
154368
# Copyright (c) 2017 OpenStack Foundation # 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
66580
# Generated by the protocol buffer compiler. DO NOT EDIT! # sources: cosmos/mint/v1beta1/genesis.proto, cosmos/mint/v1beta1/mint.proto, cosmos/mint/v1beta1/query.proto # plugin: python-betterproto from dataclasses import dataclass from typing import Dict import betterproto from betterproto.grpc.grpclib_server import ...
StarcoderdataPython
3339850
<gh_stars>10-100 # -*- coding: utf-8 -*- from dku_plugin_test_utils import dss_scenario def test_textcleaning_english_tweets(user_dss_clients): dss_scenario.run(user_dss_clients, project_key="TEST_TEXTPREPARATIONPLUGIN", scenario_id="TEST_TEXTCLEANING_TWEETS") def test_textcleaning_multilingual_news(user_dss_cl...
StarcoderdataPython
1776717
# -*- coding: utf-8 -*- # Generated by Django 1.11 on 2018-05-16 01:21 from __future__ import unicode_literals from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependenc...
StarcoderdataPython
146233
#!/usr/bin/python # # Copyright (c) 2017 Ensoft Ltd, 2010 <NAME> # # 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,...
StarcoderdataPython
127393
# Generated by Django 3.1.7 on 2021-02-27 12:37 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('blog', '0006_auto_20210227_1348'), ] operations = [ migrations.AlterField( model_name='post', name='thumbnail', ...
StarcoderdataPython
3356700
<filename>committees/migrations/0026_person_membership.py # Generated by Django 3.1.8 on 2021-08-09 07:12 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('committees', '0025_remove_committeepage_leader_name'), ] operations = [ migrations...
StarcoderdataPython
126552
"""Provides utility functions for unit testing.""" from ..pygraph import (DirectedGraph, UndirectedGraph, build_triangle_graph, build_k5_graph, build_k33_graph, build_5_cycle_graph, merge_graphs) def build_simple_test_graph(directed=False): """Builds a simple undirected ...
StarcoderdataPython
1720061
<filename>keyprocessor.py import pygame def getkey(key, shift: bool): if not shift: match key: case pygame.K_0: return '0' case pygame.K_1: return '1' case pygame.K_2: return '2' case pygame.K_3: ...
StarcoderdataPython
1659323
<gh_stars>0 # is it a good idea to put it on a top-level here?.. maybe some singleton would be nicer or something... from cffi import FFI ffi = FFI() ffi.cdef(''' //typedef ... Treal; // damn, stuff like this doesn't work with cffi yet... structs are fine, but not the basic types :( // so, we stick to 'double' here: ...
StarcoderdataPython
3382206
<filename>discursus_core/solids/enhance_mentions_solid.py # Credit goes to... # https://github.com/quakerpunk/content-audit/blob/origin/content_audit.py from dagster import solid from bs4 import BeautifulSoup from optparse import OptionParser import urllib.request import urllib.error import random import csv import ur...
StarcoderdataPython
1745021
import logging import random from pajbot.managers.handler import HandlerManager from pajbot.managers.db import DBManager from pajbot.modules import BaseModule from pajbot.modules import ModuleSetting from pajbot.models.user import User log = logging.getLogger(__name__) class RandomRedeem(BaseModule): ID = __nam...
StarcoderdataPython
84
import logging from asyncio import sleep import discord from discord.ext import commands from config import SETTINGS from crew import crew_embed from diary import diary_embed from film import film_embed from helpers import LetterboxdError from list_ import list_embed from review import review_embed from user import us...
StarcoderdataPython
3292885
import matplotlib.pyplot as plt import cPickle as pkl from SpikeTrainComparator import * from SpikingModel import * from Trace import * class Experiment : """ Objects of this class contains the experimental data and an "AEC object" that takes care of Active Electrode Compensation """ d...
StarcoderdataPython
1631017
<gh_stars>10-100 import builtins import enum from collections import defaultdict from enum import Enum from typing import Dict, List, Union, Tuple import brightway2 as bw import ipywidgets as widgets import numpy as np from IPython.core.display import HTML from bw2data.backends import LCIBackend from bw2data.backends....
StarcoderdataPython
142886
<filename>src/results_processing/plot.py import numpy as np from sklearn import metrics import matplotlib.pyplot as plt def confusion_matrix(data_test, target_test, clf, clf_name, network_name): """ Plot and save confuction matrix. Args: data_test (numpy.ndarray): Test data samples target...
StarcoderdataPython
3385169
<gh_stars>10-100 """ Copyright (C) 2021 Intel Corporation SPDX-License-Identifier: BSD-3-Clause """ import json import os import requests import jwt SERVER_URL = "http://localhost:5005" def get_sanic_server_ssl(app): # read sanic variables ssl = { "cert": os.path.join("/run/secrets", app.config....
StarcoderdataPython