conversations listlengths 2 3 | source stringclasses 1 value | stack stringclasses 1 value |
|---|---|---|
[
{
"from": "system",
"value": "Improve dish/table assignment initialization function\n"
},
{
"from": "human",
"value": "from libcpp.vector cimport vector\nfrom libcpp.map cimport map\nfrom libc.stddef cimport size_t\n\nfrom microscopes._shared_ptr_h cimport shared_ptr\nfrom microscopes.common._ra... | cython | chosen |
[
{
"from": "system",
"value": "Fix ctypedef for size_t, should be removed when Cython-0.11 gets released"
},
{
"from": "human",
"value": "#---------------------------------------------------------------------\n\ncdef extern from *:\n ctypedef unsigned long size_t\n\n#--------------------------... | cython | chosen |
[
{
"from": "system",
"value": "Remove the inline from WindowedValue.create()\n"
},
{
"from": "human",
"value": "#\n# Licensed to the Apache Software Foundation (ASF) under one or more\n# contributor license agreements. See the NOTICE file distributed with\n# this work for additional information ... | cython | chosen |
[
{
"from": "system",
"value": "Write a factory function to create a Database instance\n"
},
{
"from": "human",
"value": "cimport ccygroonga\n\ndef init():\n return ccygroonga.grn_init()\n\ncdef class Database:\n cdef ccygroonga.grn_ctx* _c_ctx\n cdef ccygroonga.grn_obj* _c_db\n\n def ... | cython | chosen |
[
{
"from": "system",
"value": "Use identical names for C and python\n"
},
{
"from": "human",
"value": "from math import log\n\ncdef extern from \"mtwist-1.1/mtwist.c\":\n double mt_drand()\n void mt_seed32new(unsigned int)\n\ndef uniform():\n return mt_drand()\n\ndef exp(p):\n u = 1.0... | cython | chosen |
[
{
"from": "system",
"value": "Fix test case syntax error\n"
},
{
"from": "human",
"value": "__doc__ = u\"\"\"\n >>> test()\n neg False\n pos True\n neg\n pos\n neg\n pos\n\"\"\"\n\ndef test():\n cdef long neg = -1\n cdef unsigned long pos = -2 # will be a large positiv... | cython | chosen |
[
{
"from": "system",
"value": "Fix tests for compiled code.\n"
},
{
"from": "human",
"value": "from daapserver cimport constants\n\ncimport cython\n\ncdef class TreeRevisionStorage(object):\n cpdef public int revision\n cdef int last_operation\n cdef object storage\n\n @cython.locals(... | cython | chosen |
[
{
"from": "system",
"value": "Disable test for libc.stdint (missing stdint.h in MSVC)\n"
},
{
"from": "human",
"value": "cimport libc\n\ncimport libc.stdio\ncimport libc.errno\ncimport libc.float\ncimport libc.limits\ncimport libc.locale\ncimport libc.signal\ncimport libc.stddef\ncimport libc.st... | cython | chosen |
[
{
"from": "system",
"value": "Enable usage of std::move() only in the supported versions of MSVC (GH-4191)\n\n"
},
{
"from": "human",
"value": "cdef extern from \"<utility>\" namespace \"std\" nogil:\n cdef cppclass pair[T, U]:\n ctypedef T first_type\n ctypedef U second_type\n... | cython | chosen |
[
{
"from": "system",
"value": "Fix bug introduced by pep8 changes\n"
},
{
"from": "human",
"value": "#!/usr/bin/python\n\nimport json\nfrom Bio import SeqIO\n\n\ndef compute(inputfile, format):\n cdef str line = ''\n cdef int i = 0\n cdef int j = 0\n cdef int line_len = 0\n cdef st... | cython | chosen |
[
{
"from": "system",
"value": "Use a different constant (PI instead of NAN) in the \"import *\" test since NAN does not seem to be defined by MSVC.\n"
},
{
"from": "human",
"value": "# mode: run\n\ncdef object executable, version_info\ncdef long hexversion\n\nctypedef struct MyStruct:\n int x,... | cython | chosen |
[
{
"from": "system",
"value": "Add _defn to state object\n"
},
{
"from": "human",
"value": "from cython.operator cimport dereference as deref\nfrom libcpp.vector cimport vector\nfrom libc.stddef cimport size_t\n\nfrom microscopes.common.variadic._dataview cimport (\n abstract_dataview,\n)\nfro... | cython | chosen |
[
{
"from": "system",
"value": "Raise an exception if a NaN is passed to prevent a memory leak\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Thu Mar 26 17:59:28 2015\n\n@author: sljg2\n\"\"\"\n\n__all__ = [\"friends_of_friends\"]\n__version__ = \"0.1\"\n__author__ ... | cython | chosen |
[
{
"from": "system",
"value": "Fix build after latest API changes from opencog\n"
},
{
"from": "human",
"value": "from cpython.ref cimport Py_INCREF, Py_DECREF\n\ncdef class PtrValue(Value):\n\n def __init__(self, obj = None, value_ptr = None):\n if obj is not None:\n Py_INCR... | cython | chosen |
[
{
"from": "system",
"value": "Remove ancient ctypedef for size_t"
},
{
"from": "human",
"value": "#---------------------------------------------------------------------\n\ncdef extern from *:\n ctypedef unsigned long int size_t\n\n#-------------------------------------------------------------... | cython | chosen |
[
{
"from": "system",
"value": "Fix compile weight_t back to double, not float\n"
},
{
"from": "human",
"value": "from libc.stdint cimport uint64_t\nfrom libc.stdint cimport uint32_t\nfrom libc.stdint cimport uint16_t\nfrom libc.stdint cimport int32_t\n\n\nctypedef float weight_t\nctypedef uint64_... | cython | chosen |
[
{
"from": "system",
"value": "Fix extern packed struct test.\n"
},
{
"from": "human",
"value": "# ticket: 290\n# mode: error\n\ncdef extern:\n cdef packed struct MyStruct:\n char a\n\n_ERRORS = u\"\"\"\n5:9: Cannot declare extern struct as 'packed'\n\"\"\"\n"
},
{
"from": "gpt"... | cython | chosen |
[
{
"from": "system",
"value": "Fix return value of Grid.__str__()\n"
},
{
"from": "human",
"value": "\nEMPTY_PLAYER = ' '\nEMPTY_CSA = <Koma>None\n\n\ncdef class Grid:\n\n '''Grid class\n\n Args\n -------------------\n which_player : optional (default = None)\n csa_piece : optional... | cython | chosen |
[
{
"from": "system",
"value": "Expand and fix cpp tests\n"
},
{
"from": "human",
"value": "cdef extern from \"shapes.h\" namespace shapes:\n\n cdef cppclass Shape:\n area()\n \n cdef cppclass Rectangle(Shape):\n int width\n int height\n __init__(int, int)\n ... | cython | chosen |
[
{
"from": "system",
"value": "OTHER: Fix string constness in to_unicode\n"
},
{
"from": "human",
"value": "from cpython.unicode cimport PyUnicode_DecodeUTF8, PyUnicode_AsUTF8String\n\ncdef inline to_unicode(char *s):\n\ttry:\n\t\tns = PyUnicode_DecodeUTF8(s, len(s), NULL)\n\texcept:\n\t\tns = s\... | cython | chosen |
[
{
"from": "system",
"value": "Add MindAgent::stimulateAtom to the python bindings\n"
},
{
"from": "human",
"value": "# it'd be nice to define the type of atomspace but I can't get this working\nfrom opencog.cogserver cimport cAgent, stim_t, string\n\ncdef class MindAgent:\n # TODO add a point... | cython | chosen |
[
{
"from": "system",
"value": "Check activeinfo inputs for empty arrays\n\nThe prior check, `not xs`, only works for sequence-like objects.\nUnfortunately numpy arrays are not sequences, so we have to\nactually check the length.\n"
},
{
"from": "human",
"value": "cimport cython.array\ncimport num... | cython | chosen |
[
{
"from": "system",
"value": "Test for bad buffer types.\n"
},
{
"from": "human",
"value": "cdef object[int] buf\ncdef class A:\n cdef object[int] buf\n\ndef f():\n cdef object[fakeoption=True] buf1\n cdef object[int, -1] buf1b \n cdef object[ndim=-1] buf2\n cdef object[int, 'a'] ... | cython | chosen |
[
{
"from": "system",
"value": "Add non-logarithmic normal for mixture model\n"
},
{
"from": "human",
"value": "\"A bunch of improper (not normalized) prior distributions\"\nfrom libc.math cimport log, fabs\n\ncdef inline double ln_normal(double value, double mean, double stddev):\n cdef double... | cython | chosen |
[
{
"from": "system",
"value": "Fix test compile failure in MSVC.\n"
},
{
"from": "human",
"value": "cdef extern from *:\n \"\"\"\n #if defined(WIN32) || defined(MS_WINDOWS)\n #include \"windows.h\"\n #define myapp_sleep(m) Sleep(m)\n #else\n #include <unistd.h>\n #de... | cython | chosen |
[
{
"from": "system",
"value": "Change include path and get rid of the warning.\n"
},
{
"from": "human",
"value": "from libcpp cimport bool as cpp_bool\nfrom libcpp.string cimport string\nfrom libcpp.vector cimport vector\nfrom libc.stdint cimport uint32_t\nfrom libc.stdint cimport int64_t\nfrom l... | cython | chosen |
[
{
"from": "system",
"value": "Change the declaration of PyFloat_FromString to the Py3 signature and provide a fallback for Py2.\n\nCloses https://github.com/cython/cython/issues/3909\n"
},
{
"from": "human",
"value": "cdef extern from \"Python.h\":\n\n ########################################... | cython | chosen |
[
{
"from": "system",
"value": "Return as string and not as bytes.\n"
},
{
"from": "human",
"value": "#/*##########################################################################\n#\n# The fisx library for X-Ray Fluorescence\n#\n# Copyright (c) 2014-2016 European Synchrotron Radiation Facility\n#... | cython | chosen |
[
{
"from": "system",
"value": "Add a test for namespaced struct with memoryview"
},
{
"from": "human",
"value": "# tag: cpp\n# mode: compile\n\ncdef extern from \"point.h\" namespace \"geometry\":\n\n cdef struct Point:\n double x\n double y\n int color\n\ncdef Point p = P... | cython | chosen |
[
{
"from": "system",
"value": "Add a test for namespaced struct with memoryview\n"
},
{
"from": "human",
"value": "# tag: cpp\n# mode: compile\n\ncdef extern from \"point.h\" namespace \"geometry\":\n\n cdef struct Point:\n double x\n double y\n int color\n\ncdef Point p =... | cython | chosen |
[
{
"from": "system",
"value": "Fix w_uninitilized_del testcase, now inferred as python object\n"
},
{
"from": "human",
"value": "# cython: warn.maybe_uninitialized=True\n# mode: error\n# tag: werror\n\ndef foo(x):\n a = 1\n del a, b\n b = 2\n return a, b\n\n_ERRORS = \"\"\"\n7:9: Dele... | cython | chosen |
[
{
"from": "system",
"value": "Add comment in doc example to explain that two ways to compare pointers are equivalent\n"
},
{
"from": "human",
"value": "from libc.stdio cimport FILE, fopen\r\nfrom libc.stdlib cimport malloc, free\r\nfrom cpython.exc cimport PyErr_SetFromErrnoWithFilenameObject\r\... | cython | chosen |
[
{
"from": "system",
"value": "Fix spelling error in variable name\n"
},
{
"from": "human",
"value": "from libcpp.vector cimport vector\nfrom libcpp.map cimport map\nfrom libc.stddef cimport size_t\n\nfrom microscopes._shared_ptr_h cimport shared_ptr\nfrom microscopes.common._random_fwd_h cimport... | cython | chosen |
[
{
"from": "system",
"value": "Make the desktop use CLASSPATH if defined.\n"
},
{
"from": "human",
"value": "# on desktop, we need to create an env :)\n# example taken from http://www.inonit.com/cygwin/jni/invocationApi/c.html\n\ncdef extern jint JNI_CreateJavaVM(JavaVM **pvm, void **penv, void *... | cython | chosen |
[
{
"from": "system",
"value": "Remove tensor attribute from Span and Token.\n"
},
{
"from": "human",
"value": "cimport numpy as np\n\nfrom .doc cimport Doc\n\n\ncdef class Span:\n cdef readonly Doc doc\n cdef readonly int start\n cdef readonly int end\n cdef readonly int start_char\n ... | cython | chosen |
[
{
"from": "system",
"value": "Add cfg field to Tagger\n"
},
{
"from": "human",
"value": "from thinc.linear.avgtron cimport AveragedPerceptron\nfrom thinc.extra.eg cimport Example\nfrom thinc.structs cimport ExampleC\n\nfrom .structs cimport TokenC\nfrom .vocab cimport Vocab\n\n\ncdef class Tagge... | cython | chosen |
[
{
"from": "system",
"value": "Enumerate core audio devices in cython.\n\n\n"
},
{
"from": "human",
"value": "cimport AudioHardware\nfrom AudioHardware cimport *\ncimport stdlib\n\ndef yo():\n\tcdef UInt32 sz, ndevices\n\tcdef AudioDeviceID *devices\n\tcdef char *name\n\n\tAudioHardwareGetPropert... | cython | chosen |
[
{
"from": "system",
"value": "Fix long to long long.\n"
},
{
"from": "human",
"value": "# distutils: language = c++\n\ncdef extern from '../cuda/cupy_common.h': # thru parent to import in core\n ctypedef char cpy_byte\n ctypedef unsigned char cpy_ubyte\n ctypedef short cpy_short\n c... | cython | chosen |
[
{
"from": "system",
"value": "Make create() avaialable to pure python callers\n"
},
{
"from": "human",
"value": "#\n# Licensed to the Apache Software Foundation (ASF) under one or more\n# contributor license agreements. See the NOTICE file distributed with\n# this work for additional informatio... | cython | chosen |
[
{
"from": "system",
"value": "Replace __ prefixes with cdefs for better encapsulation\n"
},
{
"from": "human",
"value": "# Copyright (c) 2017 The Regents of the University of Michigan.\n# All Rights Reserved. Licensed according to the terms of the Revised\n# BSD License. See LICENSE.txt for deta... | cython | chosen |
[
{
"from": "system",
"value": "Fix string format error in 2.6\n\nIn 2.6, you should give index value to format."
},
{
"from": "human",
"value": "\ncdef class LocalRef:\n cdef jobject obj\n\n def __cinit__(self):\n self.obj = NULL\n\n def __dealloc__(self):\n cdef JNIEnv *j_... | cython | chosen |
[
{
"from": "system",
"value": "Update (unrelated) test warnings after changing utility code in MemoryView.pyx.\n"
},
{
"from": "human",
"value": "# ticket: 3111\n# mode: compile\n# tag: warnings\n\nctypedef unsigned char npy_uint8\nctypedef unsigned short npy_uint16\n\n\nctypedef fused dtype_t:\n... | cython | chosen |
[
{
"from": "system",
"value": "Fix typo and now it compiles successfully\n"
},
{
"from": "human",
"value": "cimport ccygroonga\n\ndef init():\n return ccygroonga.grn_init()\n\n#cdef class Database:\n# cdef ccygroonga.grn_ctx* _c_ctx\n# cdef ccygroonga.grn_obj* _c_cb\n#\n# def __cinit_... | cython | chosen |
[
{
"from": "system",
"value": "Add Cython compiler directives waiting release 0.11.2\n"
},
{
"from": "human",
"value": "#cython: embedsignature=True\ninclude \"PETSc/PETSc.pyx\"\n"
},
{
"from": "gpt",
"value": "#cython: embedsignature=True\n#cython: cdivision=True\n#cython: always_all... | cython | chosen |
[
{
"from": "system",
"value": "Change test to initialize by `import_datetime`"
},
{
"from": "human",
"value": "# coding: utf-8\n\n#import datetime\nfrom cpython.datetime cimport date, time, datetime, timedelta, PyDateTime_IMPORT\n\nPyDateTime_IMPORT\n \ndef test_date(int year, int month, i... | cython | chosen |
[
{
"from": "system",
"value": "Fix File error handling rules\n"
},
{
"from": "human",
"value": "# -----------------------------------------------------------------------------\n\ncdef inline int comm_set_eh(MPI_Comm ob) nogil except -1:\n if ob == MPI_COMM_NULL: return 0\n cdef int opt = op... | cython | chosen |
[
{
"from": "system",
"value": "Set default backends from environment variables\n"
},
{
"from": "human",
"value": "cdef list _reduction_backends = []\ncdef list _routine_backends = []\n\n\ndef _get_backend(str s):\n if s == 'cub':\n return BACKEND_CUB\n # if s == 'cutensor':\n # ... | cython | chosen |
[
{
"from": "system",
"value": "Add definition of Mixture Model"
},
{
"from": "human",
"value": "from model cimport LineModel\n\ncdef class FitGaussian(LineModel):\n\n cdef:\n double[:] data\n double[:] weights\n\n # Prior parameters\n\n # Mean and center of the prio... | cython | chosen |
[
{
"from": "system",
"value": "Correct cleanup when server fails\n\nSummary:\nServer has been crashing hard when it should be crashing soft (for\nexample, when binding to the same port. This diff fixes it.\n\nReviewed By: yfeldblum\n\nDifferential Revision: D4242841\n\nfbshipit-source-id: 242ee09ea244ce662c3... | cython | chosen |
[
{
"from": "system",
"value": "Use c++0x rather than c++11 when building tests to allow for versions of\ngcc older than 4.7. This fixes a recurring Travis build failure.\n"
},
{
"from": "human",
"value": "# distutils: extra_compile_args=-std=c++11\n# mode: run\n# tag: cpp\n\nfrom libcpp.memory ci... | cython | chosen |
[
{
"from": "system",
"value": "Add line break to end of file\n"
},
{
"from": "human",
"value": "from libcpp.vector cimport vector\nfrom libcpp.utility cimport pair\nfrom libc.stddef cimport size_t\n\nfrom microscopes.common._random_fwd_h cimport rng_t\n\ncdef extern from \"microscopes/common/enti... | cython | chosen |
[
{
"from": "system",
"value": "Fix a bug in zmq.check\n"
},
{
"from": "human",
"value": "#cython: embedsignature=True\n\nimport zmq\ncimport zmq.backend.cython.libzmq as libzmq\nfrom zmq.backend.cython.socket cimport Socket\nfrom libc.stdint cimport uint64_t\n\nclass ZMQLinkingError(Exception):\n... | cython | chosen |
[
{
"from": "system",
"value": "Extend CPython C-API test to at least include (and thus parser) all .pxd files.\n"
},
{
"from": "human",
"value": "\nfrom libc.stdio cimport sprintf\nfrom cpython cimport PyType_Check\nfrom cpython cimport PyType_Check as PyType_Check2\nfrom cpython.type cimport PyT... | cython | chosen |
[
{
"from": "system",
"value": "Fix for different Windows float repr\n"
},
{
"from": "human",
"value": "def floor_div_float(double a, double b):\n \"\"\"\n >>> floor_div_float(2, 1.5)\n 1.0\n >>> floor_div_float(2, -1.5)\n -2.0\n >>> floor_div_float(-2.3, 1.5)\n -2.0\n >>> ... | cython | chosen |
[
{
"from": "system",
"value": "Add bag of words to header\n"
},
{
"from": "human",
"value": "from cymem.cymem cimport Pool\n\nfrom ..structs cimport TemplateC, FeatureC\nfrom ..typedefs cimport atom_t\n\n\ncdef class ConjunctionExtracter:\n cdef Pool mem\n cdef readonly int nr_templ\n cd... | cython | chosen |
[
{
"from": "system",
"value": "Make parameter a reference parameter\n"
},
{
"from": "human",
"value": "from libcpp.vector cimport vector\nfrom libcpp.map cimport map\nfrom libc.stddef cimport size_t\n\nfrom microscopes._shared_ptr_h cimport shared_ptr\nfrom microscopes.common._random_fwd_h cimpor... | cython | chosen |
[
{
"from": "system",
"value": "Fix C++ header name in Cython header\n\nAs the `_base` suffix has been dropped, update the Cython header\naccordingly.\n"
},
{
"from": "human",
"value": "cimport cython\nfrom cython cimport floating\n\n\ncdef extern from \"rank_filter_base.hxx\" namespace \"rank_fil... | cython | chosen |
[
{
"from": "system",
"value": "Fix channel bindings type signature\n\nCython 0.22 didn't like that we didn't have the `except NULL`\nclause on the `__cvalue__` method in `ChannelBindings` in the\n.pxd file. This adds the clause to the .pxd file.\n"
},
{
"from": "human",
"value": "from libc.stdli... | cython | chosen |
[
{
"from": "system",
"value": "Implement an `ndindex`-like Cython function\n\nProvides a Cython function that acts similarly to `ndindex`. However it\nis written in C-style. So it does not yield, does not use classes, etc.\nIt also doesn't keep state. However it can be used like a generator\nexcept in a `whi... | cython | chosen |
[
{
"from": "system",
"value": "Add comments around cryptic stuct.unpack invocation.\n"
},
{
"from": "human",
"value": "import hashlib\nimport struct\n\nfrom simhash cimport compute as c_compute\nfrom simhash cimport find_all as c_find_all\n\n\ndef unsigned_hash(bytes obj):\n '''Returns a hash ... | cython | chosen |
[
{
"from": "system",
"value": "Optimize construction of label indices\n"
},
{
"from": "human",
"value": "cimport numpy as np\nfrom scipy import sparse\n\ndef extents_count(Py_ssize_t[::1] labels,\n Py_ssize_t[::1] curr_loc, Py_ssize_t[::1] indices):\n cdef Py_ssize_t i\n fo... | cython | chosen |
[
{
"from": "system",
"value": "Revert nogil .pxd to master (appears unused?)\n"
},
{
"from": "human",
"value": "# -*- mode: cython -*-\n# -*- coding: utf-8 -*-\n\nfrom libcpp cimport bool\nfrom libcpp.vector cimport vector\nfrom libcpp.utility cimport pair\nfrom cvodes_cxx cimport LMM, IterType\n... | cython | chosen |
[
{
"from": "system",
"value": "Use only create_value_by_type to create Value or Atom in execute_atom() method\n"
},
{
"from": "human",
"value": "from opencog.atomspace cimport Atom, AtomSpace, TruthValue, PtrHolder\nfrom opencog.atomspace cimport cAtomSpace, cTruthValue\nfrom opencog.atomspace ci... | cython | chosen |
[
{
"from": "system",
"value": "Add doc string to point in polygon functions\n"
},
{
"from": "human",
"value": "#cython: cdivison=True\n#cython: boundscheck=False\n#cython: nonecheck=False\n#cython: wraparound=False\n\n\ncdef inline unsigned char point_in_polygon(int nr_verts, double *xp, double *... | cython | chosen |
[
{
"from": "system",
"value": "Revert D22499183: refactor Enum code generation\n\nDifferential Revision:\nD22499183 (https://github.com/facebook/folly/commit/24364356023d04f966a0ef6fc7536363932bdc82)\n\nOriginal commit changeset: b2af8d94024c\n\nfbshipit-source-id: a6bd56cdb4d4b73618a9374528371c5b18a0df10\n"... | cython | chosen |
[
{
"from": "system",
"value": "Add nr_out attribute to AveragedPerceptron\n"
},
{
"from": "human",
"value": "from cymem.cymem cimport Pool\nfrom preshed.maps cimport PreshMap\n\nfrom .features cimport ConjunctionExtracter\nfrom ..typedefs cimport weight_t, feat_t, class_t\nfrom ..structs cimport ... | cython | chosen |
[
{
"from": "system",
"value": "Remove unused cimport of indextype\n"
},
{
"from": "human",
"value": "# -*- mode: cython -*-\n# -*- coding: utf-8 -*-\n\nfrom libcpp cimport bool\nfrom libcpp.vector cimport vector\nfrom libcpp.utility cimport pair\nfrom cvodes_cxx cimport LMM, IterType, LinSol, rea... | cython | chosen |
[
{
"from": "system",
"value": "Fix test compile failure in MSVC.\n"
},
{
"from": "human",
"value": "cdef extern from *:\n \"\"\"\n #if defined(WIN32) || defined(MS_WINDOWS)\n #include \"synchapi.h\"\n #define myapp_sleep(m) Sleep(m)\n #else\n #include <unistd.h>\n #d... | cython | chosen |
[
{
"from": "system",
"value": "Add newline at the end of file"
},
{
"from": "human",
"value": "# Cython/distutils can only handle a single file as the source for\n# a python module. Since it is helpful to be able to split the binding\n# code into separate files, we just include them here.\n#\n# ... | cython | chosen |
[
{
"from": "system",
"value": "Use format string with SDL_SetError.\n\nFixes #26, although the fix wasn't tested.\n"
},
{
"from": "human",
"value": "# Copyright 2014 Tom Rothamel <tom@rothamel.us>\n#\n# This software is provided 'as-is', without any express or implied\n# warranty. In no event wi... | cython | chosen |
[
{
"from": "system",
"value": "Change demo file back to original output style.\n"
},
{
"from": "human",
"value": "def fib(n):\n \"\"\"Print the Fibonacci series up to n.\"\"\"\n a, b = 0, 1\n while b < n:\n print(b)\n a, b = b, a + b\n"
},
{
"from": "gpt",
"valu... | cython | chosen |
[
{
"from": "system",
"value": "Add testcase for local variable deletion\n"
},
{
"from": "human",
"value": "# mode: run\n# tag: control-flow, uninitialized\n\ndef conditional(cond):\n \"\"\"\n >>> conditional(True)\n []\n >>> conditional(False)\n Traceback (most recent call last):\n... | cython | chosen |
[
{
"from": "system",
"value": "Put a dummy processing in the function rather than asking the user for decision.\n"
},
{
"from": "human",
"value": "def process_byte_data(unsigned char[:] data, bint return_all):\r\n # ... process the data\r\n if return_all:\r\n return bytes(data)\r\n ... | cython | chosen |
[
{
"from": "system",
"value": "Fix unrelated test after changing MemoryView.pyx.\n"
},
{
"from": "human",
"value": "# ticket: 3111\n# mode: compile\n# tag: warnings\n\nctypedef unsigned char npy_uint8\nctypedef unsigned short npy_uint16\n\n\nctypedef fused dtype_t:\n npy_uint8\n\nctypedef fuse... | cython | chosen |
[
{
"from": "system",
"value": "Simplify and speed up dit.math.close\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\"\"\"\nLow level implementation of scalar `allclose`.\n\n\"\"\"\n\ncdef extern from \"math.h\":\n double fabs(double)\n int isinf(double)... | cython | chosen |
[
{
"from": "system",
"value": "File: Use PyUnicode_EncodeFSDefault() to encode unicode paths\n"
},
{
"from": "human",
"value": "#------------------------------------------------------------------------------\n\ncdef extern from \"Python.h\":\n object PyOS_FSPath(object)\n\ncdef os_fsencode\nfr... | cython | chosen |
[
{
"from": "system",
"value": "Make fnv object more like hashlib hashes\n"
},
{
"from": "human",
"value": "cdef extern from \"<stdint.h>\" nogil:\n ctypedef unsigned long long uint64_t\n\ncdef extern from \"fnv1a.h\":\n void fnv1a(const char *foo, const int length, uint64_t *hash);\n\ncdef ... | cython | chosen |
[
{
"from": "system",
"value": "Use size_t to store Python object id"
},
{
"from": "human",
"value": "# This file is part of h5py, a Python interface to the HDF5 library.\n#\n# http://www.h5py.org\n#\n# Copyright 2008-2013 Andrew Collette and contributors\n#\n# License: Standard 3-clause BSD; see... | cython | chosen |
[
{
"from": "system",
"value": "Document the motivation for the fix\n"
},
{
"from": "human",
"value": "from av.video.frame cimport VideoFrame\n\n\ncdef class VideoPlane(Plane):\n \n def __cinit__(self, VideoFrame frame, int index):\n \n for i in range(frame.format.ptr.nb_compon... | cython | chosen |
[
{
"from": "system",
"value": "Add new line at the end of file\n"
},
{
"from": "human",
"value": "# coding: utf-8\n\n#import datetime\nfrom cpython.datetime cimport date, time, datetime, timedelta, PyDateTime_IMPORT\n\nPyDateTime_IMPORT\n \ndef test_date(int year, int month, int day):\n ... | cython | chosen |
[
{
"from": "system",
"value": "Add some more test cases\n"
},
{
"from": "human",
"value": "# cython: binding=True\n# mode: run\n# tag: cyfunction\n\ndef test_dict():\n \"\"\"\n >>> test_dict.foo = 123\n >>> test_dict.__dict__\n {'foo': 123}\n \"\"\"\n\ndef test_name():\n \"\"\"\... | cython | chosen |
[
{
"from": "system",
"value": "Use a very minimal typedef of the ndarray class (the only struct member we need access to in this code is 'nd')--this allows us to avoid a global variable lookup of 'ndarray' when calling 'ndarray.tp_as_mapping.mp_subscript'. Now, in the common case of ndim==1, Column (but not... | cython | chosen |
[
{
"from": "system",
"value": "Revert \"Fix test.\" (which only applied to the 0.29.x branch).\n\nThis reverts commit bfcaf163e3dcf472ef2af5dec6ac3fffd0d34e66.\n"
},
{
"from": "human",
"value": "# ticket: 3111\n# mode: compile\n# tag: warnings\n\nctypedef unsigned char npy_uint8\nctypedef unsigne... | cython | chosen |
[
{
"from": "system",
"value": "Use False instead 0 for bint\n"
},
{
"from": "human",
"value": "# Copyright 2019 gRPC authors.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the... | cython | chosen |
[
{
"from": "system",
"value": "Use absolute `cimport` in *.pxd files. Relative cimporting doesn't appear to work.\n\nAlso, alphabetize import in \"cytoolz/__init__.pxd\" (just because). The main\nreason we don't do `from cytoolz.itertoolz cimport *` is so there is a quick\nand easy reference for what is ci... | cython | chosen |
[
{
"from": "system",
"value": "Add testcase for closure variable deletion\n"
},
{
"from": "human",
"value": "# mode: error\n\ncdef struct S:\n int m\n\ndef f(a):\n cdef int i, x[2]\n cdef S s\n global j\n del f() # error\n del i # error: deletion of non-Python object\n del j ... | cython | chosen |
[
{
"from": "system",
"value": "Fix test setup for compile-only test file.\n"
},
{
"from": "human",
"value": "# Need to include all utility code !\n\nasync def sleep(x):\n pass\n\n\nasync def call():\n await sleep(1)\n yield\n"
},
{
"from": "gpt",
"value": "# mode: compile\n# ... | cython | chosen |
[
{
"from": "system",
"value": "Update code to pass tests\n"
},
{
"from": "human",
"value": "cimport cython.array\ncimport numpy\nimport numpy\n\ncdef extern from \"stdint.h\":\n ctypedef unsigned long uint64_t\n\ncdef extern from \"inform/time_series.h\":\n double inform_active_info(const u... | cython | chosen |
[
{
"from": "system",
"value": "Use 32 bit floats, not 64 bit.\n"
},
{
"from": "human",
"value": "from libc.stdint cimport uint64_t\nfrom libc.stdint cimport uint32_t\nfrom libc.stdint cimport uint16_t\nfrom libc.stdint cimport int32_t\n\n\nctypedef double weight_t\nctypedef uint64_t atom_t\nctype... | cython | chosen |
[
{
"from": "system",
"value": "Make a working test actually test something.\n"
},
{
"from": "human",
"value": "# tag: warnings\n\ncpdef str a = \"123\"\ncpdef b = 2\n\ncdef class C:\n cpdef float c\n\ndef func():\n cpdef d=C()\n return d\n\n_WARNINGS = \"\"\"\n3:6: cpdef variables will n... | cython | chosen |
[
{
"from": "system",
"value": "Fix queue Python property in StateClass\n"
},
{
"from": "human",
"value": "from libc.string cimport memcpy, memset\nfrom libc.stdint cimport uint32_t\nfrom ..vocab cimport EMPTY_LEXEME\nfrom ..structs cimport Entity\nfrom ..lexeme cimport Lexeme\nfrom ..symbols cimp... | cython | chosen |
[
{
"from": "system",
"value": "Fix unrelated test after changing MemoryView.pyx.\n"
},
{
"from": "human",
"value": "# ticket: 3111\n# mode: compile\n# tag: warnings\n\nctypedef unsigned char npy_uint8\nctypedef unsigned short npy_uint16\n\n\nctypedef fused dtype_t:\n npy_uint8\n\nctypedef fuse... | cython | chosen |
[
{
"from": "human",
"value": "Add test for memoryview of extension type\n\nA test for a bug fixed in commit 478b939a4c99a77c0863cfd.\n\nv2: add commit link above\nv3: # tag: instead of # tags:, drop cpp tag as it means something different\n that I originally thought\n\nThere was a bug that produced C code... | cython | chosen |
[
{
"from": "human",
"value": "Add some simple run tests for control-flow\n"
},
{
"from": "gpt",
"value": "# mode: run\n# tag: control-flow, uninitialized\n\ndef conditional(cond):\n \"\"\"\n >>> conditional(True)\n []\n >>> conditional(False)\n Traceback (most recent call last):\n ... | cython | chosen |
[
{
"from": "human",
"value": "Add initial Cython pyx file for glsl-parser\n"
},
{
"from": "gpt",
"value": "# distutils: language = c++\n# distutils: extra_compile_args = -fno-rtti -fno-exceptions\n\nfrom enum import IntEnum\n\nfrom libcpp cimport bool\nfrom libcpp.vector cimport vector\nfrom cyth... | cython | chosen |
[
{
"from": "human",
"value": "Add some broadcasting Cython utilities\n"
},
{
"from": "gpt",
"value": "cdef public int broadcast_arrays(list arrays, tuple broadcast_shape, int ndim,\n cnp.npy_intp **shape_out,\n cnp.npy_intp **strides... | cython | chosen |
[
{
"from": "human",
"value": "Add corner case temp (de)allocation test.\n\nThis is as simple as I could get it.\n"
},
{
"from": "gpt",
"value": "__doc__ = \"\"\"\n >>> B().coeffs_bitsize()\n [2]\n\"\"\"\n\ncdef class A:\n def numerator(self):\n return self\n\ncdef int bitsize(A a):... | cython | chosen |
[
{
"from": "human",
"value": "Add tests for std::move wrapper\n"
},
{
"from": "gpt",
"value": "# mode: run\n# tag: cpp, werror, cpp11\n\nfrom libcpp cimport nullptr\nfrom libcpp.memory cimport shared_ptr, make_shared\nfrom libcpp.utility cimport move\nfrom cython.operator cimport dereference\n\nc... | cython | chosen |
[
{
"from": "human",
"value": "Add simple test for cdef override warning\n"
},
{
"from": "gpt",
"value": "# mode: error\n# tags: werror\n\ncdef foo():\n pass\n\ndef foo():\n pass\n\n_ERRORS = u\"\"\"\n7:0: 'foo' redeclared\n7:0: Overriding cdef method with def method.\n\"\"\"\n"
}
] | cython | chosen |
[
{
"from": "human",
"value": "Add support for unicode slicing\n"
},
{
"from": "gpt",
"value": "# coding=utf-8\n__doc__ = u\"\"\"\n >>> do_slice(u'abcdef', 2, 3)\n (u'c', u'cdef', u'ab', u'abcdef')\n >>> do_slice(u'abcdef', 0, 5)\n (u'abcde', u'abcdef', u'', u'abcdef')\n\"\"\"\n\nimpor... | cython | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.